From ad5ab1216066495589d73015f47183cc26f10eb6 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Tue, 9 Jul 2013 09:09:30 +0530 Subject: dht: fix dht_discover_cbk doing a wrong layout set. with the sequence of operations are like below, we have issues with current code (MP == mountpoint): T0,MP1# mkdir /abcd (Succeeds on hash_subvol) T1,MP2# mkdir /abcd (Gets EEXIST as dir exists in hash_subvol) T2,MP2# mkdir /.gfid//xyz (lookup happens on abcd's gfid, calls dht_discover) T3,MP1# (Completes mkdir(), goes to dir_selfheal to set the layouts). T4,MP2# (dht_discover_cbk gets success for lookup as the entry existed, as layout is not yet written, it says normalize done, found holes). T5,MP2# (as layout anomaly is not considered an issue in this patch, dht_layout_set happens on inode, with all xlators pointing to 0s) T6,MP1# (completes mkdir call, inode has proper layouts) T7,MP2# mkdir /.gfid//xyz fails with ENOENT (with log saying no subvol found for hash value of xyz. Porting Amar's fix from down-stream beta branch. Change-Id: Ibdc37ee614c96158a1330af19cad81a39bee2651 BUG: 982913 Original-author: Amar Tumballi Signed-off-by: shishir gowda Reviewed-on: http://review.gluster.org/5302 Reviewed-by: Amar Tumballi Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/cluster/dht/src/dht-common.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'xlators') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index ab64f6d23..746dd1a8a 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -208,9 +208,16 @@ dht_discover_complete (xlator_t *this, call_frame_t *discover_frame) goto out; } if (ret != 0) { - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_WARNING, "normalizing failed on %s " "(overlaps/holes present)", local->loc.path); + /* We may need to do the lookup again */ + /* in discover call, parent is not know, and basename + * of entry is also not available. Without which we + * cannot build a layout correctly to heal it. Hence + * returning ESTALE */ + op_errno = ESTALE; + goto out; } if (local->inode) -- cgit