|
|
e7a346 |
From ea71f09cd6ea45a2d1525519843fc553f0e46bec Mon Sep 17 00:00:00 2001
|
|
|
e7a346 |
From: Zhang Huan <zhanghuan@open-fs.com>
|
|
|
e7a346 |
Date: Tue, 5 Sep 2017 11:36:25 +0800
|
|
|
e7a346 |
Subject: [PATCH 104/128] cluster/dht: fix crash when deleting directories
|
|
|
e7a346 |
|
|
|
e7a346 |
In DHT, after locks on all subvolumes are acquired, it would perform the
|
|
|
e7a346 |
following steps sequentially,
|
|
|
e7a346 |
1. send remove dir on all other subvolumes except the hashed one in a loop;
|
|
|
e7a346 |
2. wait for all pending rmdir to be done
|
|
|
e7a346 |
3. remove dir on the hashed subvolume
|
|
|
e7a346 |
|
|
|
e7a346 |
The problem is that in step 1 there is a check to skip hashed subvolume
|
|
|
e7a346 |
in the loop. If the last subvolume to check is actually the
|
|
|
e7a346 |
hashed one, and step 3 is quickly done before the last and hashed
|
|
|
e7a346 |
subvolume is checked, by accessing shared context data be destroyed in
|
|
|
e7a346 |
step 3, would cause a crash.
|
|
|
e7a346 |
|
|
|
e7a346 |
Fix by saving shared data in a local variable to access later in the
|
|
|
e7a346 |
loop.
|
|
|
e7a346 |
|
|
|
e7a346 |
> BUG: 1490642
|
|
|
e7a346 |
> Signed-off-by: Zhang Huan <zhanghuan@open-fs.com>
|
|
|
e7a346 |
(cherry picked from commit 206120126d455417a81a48ae473d49be337e9463)
|
|
|
e7a346 |
Change-Id: I8db7cf7cb262d74efcb58eb00f02ea37df4be4e2
|
|
|
e7a346 |
BUG: 1519076
|
|
|
e7a346 |
Signed-off-by: N Balachandran <nbalacha@redhat.com>
|
|
|
e7a346 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/124755
|
|
|
e7a346 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e7a346 |
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
e7a346 |
---
|
|
|
e7a346 |
xlators/cluster/dht/src/dht-common.c | 6 ++++--
|
|
|
e7a346 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
e7a346 |
|
|
|
e7a346 |
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
|
|
|
e7a346 |
index c6944b2..f611278 100644
|
|
|
e7a346 |
--- a/xlators/cluster/dht/src/dht-common.c
|
|
|
e7a346 |
+++ b/xlators/cluster/dht/src/dht-common.c
|
|
|
e7a346 |
@@ -8094,6 +8094,7 @@ dht_rmdir_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
dht_local_t *local = NULL;
|
|
|
e7a346 |
dht_conf_t *conf = NULL;
|
|
|
e7a346 |
int i = 0;
|
|
|
e7a346 |
+ xlator_t *hashed_subvol;
|
|
|
e7a346 |
|
|
|
e7a346 |
VALIDATE_OR_GOTO (this->private, err);
|
|
|
e7a346 |
|
|
|
e7a346 |
@@ -8111,9 +8112,10 @@ dht_rmdir_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
goto err;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
+ hashed_subvol = local->hashed_subvol;
|
|
|
e7a346 |
for (i = 0; i < conf->subvolume_cnt; i++) {
|
|
|
e7a346 |
- if (local->hashed_subvol &&
|
|
|
e7a346 |
- (local->hashed_subvol == conf->subvolumes[i]))
|
|
|
e7a346 |
+ if (hashed_subvol &&
|
|
|
e7a346 |
+ (hashed_subvol == conf->subvolumes[i]))
|
|
|
e7a346 |
continue;
|
|
|
e7a346 |
|
|
|
e7a346 |
STACK_WIND_COOKIE (frame, dht_rmdir_cbk, conf->subvolumes[i],
|
|
|
e7a346 |
--
|
|
|
e7a346 |
1.8.3.1
|
|
|
e7a346 |
|