From ade2e39f33c833dcf9811f46fca4c6f443b0f09b Mon Sep 17 00:00:00 2001 From: Avra Sengupta Date: Thu, 26 Dec 2013 05:38:44 +0000 Subject: glusterd/multiple volume locks: Fix for lock requests received in synctasked volume locks The synctasked volume lock function was locking every node with it's own UUID, instead of received UUID, which resulted in deadlock when multiple snapshot commands were executed. Change-Id: Ida76da1a057eae04178c202d626f9c1e671c1fee BUG: 1043862 Signed-off-by: Avra Sengupta --- xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c index 236d9b72f..2ebe372cc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt-handler.c @@ -63,6 +63,8 @@ glusterd_syctasked_volume_lock (rpcsvc_request_t *req, this = THIS; GF_ASSERT (this); GF_ASSERT (req); + GF_ASSERT (ctx); + GF_ASSERT (ctx->dict); ret = dict_get_int32 (ctx->dict, "volcount", &volcount); if (ret) { @@ -72,21 +74,22 @@ glusterd_syctasked_volume_lock (rpcsvc_request_t *req, "Failed to get volname"); goto out; } - ret = glusterd_volume_lock (volname, MY_UUID); + ret = glusterd_volume_lock (volname, ctx->uuid); if (ret) gf_log (this->name, GF_LOG_ERROR, "Unable to acquire local lock for %s", volname); } else { /* Trying to acquire volume locks on multiple volumes */ - ret = glusterd_multiple_volumes_lock (ctx->dict, MY_UUID); + ret = glusterd_multiple_volumes_lock (ctx->dict, ctx->uuid); if (ret) gf_log ("", GF_LOG_ERROR, - "Failed to acquire volume locks on localhost"); + "Failed to acquire volume locks for %s", + uuid_utoa (ctx->uuid)); } out: - glusterd_mgmt_v3_vol_lock_send_resp (req, ret); + ret = glusterd_mgmt_v3_vol_lock_send_resp (req, ret); gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret); return ret; @@ -749,20 +752,21 @@ glusterd_syctasked_volume_unlock (rpcsvc_request_t *req, "Failed to get volname"); goto out; } - ret = glusterd_volume_unlock (volname, MY_UUID); + ret = glusterd_volume_unlock (volname, ctx->uuid); if (ret) gf_log (this->name, GF_LOG_ERROR, - "Unable to acquire local lock for %s", volname); + "Unable to release lock for %s", volname); } else { /* Trying to release volume locks on multiple volumes */ - ret = glusterd_multiple_volumes_unlock (ctx->dict, MY_UUID); + ret = glusterd_multiple_volumes_unlock (ctx->dict, ctx->uuid); if (ret) gf_log ("", GF_LOG_ERROR, - "Failed to release volume locks on localhost"); + "Failed to release volume locks for %s", + uuid_utoa(ctx->uuid)); } out: - glusterd_mgmt_v3_vol_unlock_send_resp (req, ret); + ret = glusterd_mgmt_v3_vol_unlock_send_resp (req, ret); gf_log (this->name, GF_LOG_TRACE, "Returning %d", ret); return ret; -- cgit