From e01a7c50a0fe4ea2a70144b4405359a4fe0a27b0 Mon Sep 17 00:00:00 2001 From: Sakshi Bansal Date: Fri, 5 Feb 2016 14:51:10 +0530 Subject: dht: file rename must take blocking inode locks Backport of http://review.gluster.org/#/c/13366 Currently DHT takes non-blocking locks for file rename. Due to this during parallel renames some clients fail with EBUSY or ESTALE errors. Hence to avoid application discontinuity file rename must take blocking inode locks. > Change-Id: I986e9d08b3be359f20b1a3e1564e049b0f3dffd3 > BUG: 1304966 > Signed-off-by: Sakshi Bansal > Reviewed-on: http://review.gluster.org/13366 > Smoke: Gluster Build System > NetBSD-regression: NetBSD Build System > CentOS-regression: Gluster Build System > Reviewed-by: Raghavendra G Change-Id: I986e9d08b3be359f20b1a3e1564e049b0f3dffd3 BUG: 1310544 Signed-off-by: Sakshi Bansal Reviewed-on: http://review.gluster.org/13481 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Raghavendra G --- xlators/cluster/dht/src/dht-rename.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c index 0f8f6b2ddd5..817f2bf15ac 100644 --- a/xlators/cluster/dht/src/dht-rename.c +++ b/xlators/cluster/dht/src/dht-rename.c @@ -1191,7 +1191,7 @@ dht_rename_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (is_last_call (call_cnt)) { if (local->is_linkfile) { local->op_ret = -1; - local->op_errno = EBUSY; + local->op_errno = op_errno; goto fail; } @@ -1227,13 +1227,13 @@ dht_rename_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_msg (this->name, GF_LOG_WARNING, op_errno, DHT_MSG_INODE_LK_ERROR, "acquiring inodelk failed " - "rename (%s:%s:%s %s:%s:%s), returning EBUSY", + "rename (%s:%s:%s %s:%s:%s)", local->loc.path, src_gfid, local->src_cached->name, local->loc2.path, dst_gfid, local->dst_cached ? local->dst_cached->name : NULL); local->op_ret = -1; - local->op_errno = (op_errno == EAGAIN) ? EBUSY : op_errno; + local->op_errno = op_errno; goto done; } @@ -1309,8 +1309,8 @@ dht_rename_lock (call_frame_t *frame) local->lock.locks = lk_array; local->lock.lk_count = count; - ret = dht_nonblocking_inodelk (frame, lk_array, count, - dht_rename_lock_cbk); + ret = dht_blocking_inodelk (frame, lk_array, count, + dht_rename_lock_cbk); if (ret < 0) { local->lock.locks = NULL; local->lock.lk_count = 0; -- cgit