From 7b58df7965ad557e23681d61164bfc7d609ed2cd Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 12 Jan 2015 17:05:32 +0530 Subject: cluster/dht: Don't restore entry when only one subvolume is present Problem: When rmdir fails with op_errno other than ENOENT/EACCES then self-heal is attempted with zeroed-out stbuf. Only ia_type is filled from inode, when the self-heal progresses, it sees that the directory is still present and performs setattr with all valid flags set to '1' so the file will be owned by root:root and the time goes to epoch Fix: This fixes the problem only in dht with single subvolume. Just don't perform self-heal when there is a single subvolume. Change-Id: I6c85b845105bc6bbe7805a14a48a2c5d7bc0c5b6 BUG: 1181367 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/9435 Tested-by: Gluster Build System Reviewed-by: Shyamsundar Ranganathan Reviewed-by: Raghavendra G Tested-by: Raghavendra G --- xlators/cluster/dht/src/dht-common.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 866e3faf629..b41186215bf 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -5026,12 +5026,14 @@ dht_rmdir_hashed_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postparent, dict_t *xdata) { dht_local_t *local = NULL; + dht_conf_t *conf = NULL; int this_call_cnt = 0; call_frame_t *prev = NULL; char gfid[GF_UUID_BUF_SIZE] ={0}; local = frame->local; prev = cookie; + conf = this->private; uuid_unparse(local->loc.gfid, gfid); @@ -5040,11 +5042,12 @@ dht_rmdir_hashed_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { local->op_errno = op_errno; local->op_ret = -1; - if (op_errno != ENOENT && op_errno != EACCES) { - local->need_selfheal = 1; + if (conf->subvolume_cnt != 1) { + if (op_errno != ENOENT && op_errno != EACCES) { + local->need_selfheal = 1; + } } - gf_msg_debug (this->name, 0, "rmdir on %s for %s failed " "(gfid = %s) (%s)", -- cgit