diff options
authorZhang Huan <>2017-09-05 11:36:25 +0800
committerRaghavendra G <>2017-10-16 10:33:13 +0000
commit206120126d455417a81a48ae473d49be337e9463 (patch)
parent117c4560dcd5c7499c17a0bc8e62c62ac39745e1 (diff)
cluster/dht: fix crash when deleting directories
In DHT, after locks on all subvolumes are acquired, it would perform the following steps sequentially, 1. send remove dir on all other subvolumes except the hashed one in a loop; 2. wait for all pending rmdir to be done 3. remove dir on the hashed subvolume The problem is that in step 1 there is a check to skip hashed subvolume in the loop. If the last subvolume to check is actually the hashed one, and step 3 is quickly done before the last and hashed subvolume is checked, by accessing shared context data be destroyed in step 3, would cause a crash. Fix by saving shared data in a local variable to access later in the loop. Change-Id: I8db7cf7cb262d74efcb58eb00f02ea37df4be4e2 BUG: 1490642 Signed-off-by: Zhang Huan <>
1 files changed, 4 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index c7069a9..f6d480a 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -9306,6 +9306,7 @@ dht_rmdir_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dht_local_t *local = NULL;
dht_conf_t *conf = NULL;
int i = 0;
+ xlator_t *hashed_subvol;
VALIDATE_OR_GOTO (this->private, err);
@@ -9323,9 +9324,10 @@ dht_rmdir_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto err;
+ hashed_subvol = local->hashed_subvol;
for (i = 0; i < conf->subvolume_cnt; i++) {
- if (local->hashed_subvol &&
- (local->hashed_subvol == conf->subvolumes[i]))
+ if (hashed_subvol &&
+ (hashed_subvol == conf->subvolumes[i]))
STACK_WIND_COOKIE (frame, dht_rmdir_cbk, conf->subvolumes[i],