From ce0044ac245002da461c40e5f2014d76e31afb2a Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Wed, 3 Sep 2014 10:29:07 +0530 Subject: glusterd: Improve debugging experience for glusterd locks Today, when glusterd's internal locking mechanism fails with invalid type or when another competing lock is being held, the log message doesn't provide enough information directly as to which command saw this (first). Following is a snippet of how a failure would look in the log file. This would greatly assist in debugging. [2014-09-03 04:57:58.549418] E [glusterd-locks.c:520:glusterd_mgmt_v3_lock] (-->/usr/local/lib/glusterfs/3.7dev/xlator/mgmt/glusterd.so(__glusterd_handle_create_volume+0x801) [0x7f30b071e651] (-->/usr/local/lib/glusterfs/3.7dev/xlator/mgmt/glusterd.so(glusterd_op_begin_synctask+0x2c) [0x7f30b072e19c] (-->/usr/local/lib/glusterfs/3.7dev/xlator/mgmt/glusterd.so(gd_sync_task_begin+0x55d) [0x7f30b072de6d]))) 0-management: Invalid entity. Cannot perform locking operation on vol types Change-Id: I0595f49d60e620e8b065f3506bdb147ccee383a7 BUG: 1145093 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.org/8842 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/mgmt/glusterd/src/glusterd-locks.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'xlators/mgmt/glusterd') diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c index 53c97bea533..b2629fd87b8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-locks.c +++ b/xlators/mgmt/glusterd/src/glusterd-locks.c @@ -517,7 +517,7 @@ glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, char *type) is_valid = glusterd_mgmt_v3_is_type_valid (type); if (is_valid != _gf_true) { - gf_log (this->name, GF_LOG_ERROR, + gf_log_callingfn (this->name, GF_LOG_ERROR, "Invalid entity. Cannot perform locking " "operation on %s types", type); ret = -1; @@ -545,8 +545,9 @@ glusterd_mgmt_v3_lock (const char *name, uuid_t uuid, char *type) /* If the lock has already been held for the given volume * we fail */ if (!uuid_is_null (owner)) { - gf_log (this->name, GF_LOG_WARNING, "Lock for %s held by %s", - name, uuid_utoa (owner)); + gf_log_callingfn (this->name, GF_LOG_WARNING, + "Lock for %s held by %s", + name, uuid_utoa (owner)); ret = -1; goto out; } @@ -615,7 +616,7 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type) is_valid = glusterd_mgmt_v3_is_type_valid (type); if (is_valid != _gf_true) { - gf_log (this->name, GF_LOG_ERROR, + gf_log_callingfn (this->name, GF_LOG_ERROR, "Invalid entity. Cannot perform unlocking " "operation on %s types", type); ret = -1; @@ -642,7 +643,7 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type) } if (uuid_is_null (owner)) { - gf_log (this->name, GF_LOG_WARNING, + gf_log_callingfn (this->name, GF_LOG_WARNING, "Lock for %s %s not held", type, name); ret = -1; goto out; @@ -650,9 +651,10 @@ glusterd_mgmt_v3_unlock (const char *name, uuid_t uuid, char *type) ret = uuid_compare (uuid, owner); if (ret) { - gf_log (this->name, GF_LOG_WARNING, "Lock owner mismatch. " - "Lock for %s %s held by %s", - type, name, uuid_utoa (owner)); + gf_log_callingfn (this->name, GF_LOG_WARNING, + "Lock owner mismatch. " + "Lock for %s %s held by %s", + type, name, uuid_utoa (owner)); goto out; } -- cgit