From f02dc88786afea06e6b064a724803c82a0af90ba 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 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 --- xlators/cluster/dht/src/dht-rename.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c index 5170fac0e97..132068d43e2 100644 --- a/xlators/cluster/dht/src/dht-rename.c +++ b/xlators/cluster/dht/src/dht-rename.c @@ -1185,7 +1185,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; } @@ -1221,13 +1221,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; } @@ -1303,8 +1303,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