From 78aa2ee7d2f646a41f19858db9c48a8afc82e83f Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Wed, 29 Apr 2009 03:23:55 -0700 Subject: Cleaned up log messages in features/locks. Signed-off-by: Anand V. Avati --- xlators/features/locks/src/common.c | 15 +++++---- xlators/features/locks/src/internal.c | 63 +++++++++++++++++++---------------- xlators/features/locks/src/posix.c | 43 ++++++++++++------------ 3 files changed, 64 insertions(+), 57 deletions(-) (limited to 'xlators') diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c index 675fb0235be..92441bde0fe 100644 --- a/xlators/features/locks/src/common.c +++ b/xlators/features/locks/src/common.c @@ -64,7 +64,7 @@ pl_inode_get (xlator_t *this, inode_t *inode) pl_inode = CALLOC (1, sizeof (*pl_inode)); if (!pl_inode) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); goto out; } @@ -272,8 +272,9 @@ subtract_locks (posix_lock_t *big, posix_lock_t *small) memcpy (v.locks[1], small, sizeof (posix_lock_t)); } else { - gf_log ("posix-locks", GF_LOG_DEBUG, - "unexpected case in subtract_locks"); + gf_log ("posix-locks", GF_LOG_ERROR, + "Unexpected case in subtract_locks. Please send " + "a bug report to gluster-devel@nongnu.org"); } return v; @@ -450,7 +451,7 @@ __grant_blocked_locks (xlator_t *this, pl_inode_t *pl_inode, posix_lock_to_flock (l, &conf->user_flock); - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_TRACE, "%s (pid=%d) %"PRId64" - %"PRId64" => Granted", l->fl_type == F_UNLCK ? "Unlock" : "Lock", l->client_pid, @@ -506,7 +507,7 @@ pl_setlk (xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *lock, pthread_mutex_lock (&pl_inode->mutex); { if (__is_lock_grantable (pl_inode, lock, dom)) { - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_TRACE, "%s (pid=%d) %"PRId64" - %"PRId64" => OK", lock->fl_type == F_UNLCK ? "Unlock" : "Lock", lock->client_pid, @@ -514,7 +515,7 @@ pl_setlk (xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *lock, lock->user_flock.l_len); __insert_and_merge (pl_inode, lock, dom); } else if (can_block) { - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_TRACE, "%s (pid=%d) %"PRId64" - %"PRId64" => Blocked", lock->fl_type == F_UNLCK ? "Unlock" : "Lock", lock->client_pid, @@ -524,7 +525,7 @@ pl_setlk (xlator_t *this, pl_inode_t *pl_inode, posix_lock_t *lock, __insert_lock (pl_inode, lock, dom); ret = -1; } else { - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_TRACE, "%s (pid=%d) %"PRId64" - %"PRId64" => NOK", lock->fl_type == F_UNLCK ? "Unlock" : "Lock", lock->client_pid, diff --git a/xlators/features/locks/src/internal.c b/xlators/features/locks/src/internal.c index 5bdaeac7083..817dab4a17e 100644 --- a/xlators/features/locks/src/internal.c +++ b/xlators/features/locks/src/internal.c @@ -67,7 +67,7 @@ release_inode_locks_of_transport (xlator_t *this, inode_path (inode, NULL, &path); - gf_log (this->name, GF_LOG_DEBUG, + gf_log (this->name, GF_LOG_TRACE, "releasing lock on %s held by " "{transport=%p, pid=%"PRId64"}", path, trans, @@ -129,7 +129,7 @@ pl_inodelk (call_frame_t *frame, xlator_t *this, pinode = pl_inode_get (this, loc->inode); if (!pinode) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); op_errno = ENOMEM; goto unwind; } @@ -139,8 +139,8 @@ pl_inodelk (call_frame_t *frame, xlator_t *this, special case: this means release all locks from this transport */ - gf_log (this->name, GF_LOG_DEBUG, - "releasing all locks from transport %p", transport); + gf_log (this->name, GF_LOG_TRACE, + "Releasing all locks from transport %p", transport); release_inode_locks_of_transport (this, loc->inode, transport); goto unwind; @@ -149,7 +149,7 @@ pl_inodelk (call_frame_t *frame, xlator_t *this, reqlock = new_posix_lock (flock, transport, client_pid); if (!reqlock) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); op_ret = -1; op_errno = ENOMEM; goto unwind; @@ -172,7 +172,7 @@ pl_inodelk (call_frame_t *frame, xlator_t *this, if (can_block) goto out; - gf_log (this->name, GF_LOG_DEBUG, "returning EAGAIN"); + gf_log (this->name, GF_LOG_TRACE, "returning EAGAIN"); op_errno = EAGAIN; __destroy_lock (reqlock); goto unwind; @@ -181,8 +181,9 @@ pl_inodelk (call_frame_t *frame, xlator_t *this, default: op_errno = ENOTSUP; - gf_log (this->name, GF_LOG_ERROR, - "lock command F_GETLK not supported for GF_FILE_LK (cmd=%d)", + gf_log (this->name, GF_LOG_DEBUG, + "Lock command F_GETLK not supported for [f]inodelk " + "(cmd=%d)", cmd); goto unwind; } @@ -229,7 +230,7 @@ pl_finodelk (call_frame_t *frame, xlator_t *this, pinode = pl_inode_get (this, fd->inode); if (!pinode) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); op_errno = ENOMEM; goto unwind; } @@ -239,8 +240,8 @@ pl_finodelk (call_frame_t *frame, xlator_t *this, special case: this means release all locks from this transport */ - gf_log (this->name, GF_LOG_DEBUG, - "releasing all locks from transport %p", transport); + gf_log (this->name, GF_LOG_TRACE, + "Releasing all locks from transport %p", transport); release_inode_locks_of_transport (this, fd->inode, transport); goto unwind; @@ -249,7 +250,7 @@ pl_finodelk (call_frame_t *frame, xlator_t *this, reqlock = new_posix_lock (flock, transport, client_pid); if (!reqlock) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); op_ret = -1; op_errno = ENOMEM; goto unwind; @@ -273,7 +274,7 @@ pl_finodelk (call_frame_t *frame, xlator_t *this, if (can_block) goto out; - gf_log (this->name, GF_LOG_DEBUG, "returning EAGAIN"); + gf_log (this->name, GF_LOG_TRACE, "Returning EAGAIN"); op_errno = EAGAIN; __destroy_lock (reqlock); goto unwind; @@ -283,7 +284,8 @@ pl_finodelk (call_frame_t *frame, xlator_t *this, default: op_errno = ENOTSUP; gf_log (this->name, GF_LOG_ERROR, - "lock command F_GETLK not supported for GF_FILE_LK (cmd=%d)", + "Lock command F_GETLK not supported for [f]inodelk " + "(cmd=%d)", cmd); goto unwind; } @@ -462,8 +464,8 @@ __lock_name (pl_inode_t *pinode, const char *basename, entrylk_type type, goto out; } - gf_log (this->name, GF_LOG_DEBUG, - "blocking lock: {pinode=%p, basename=%s}", + gf_log (this->name, GF_LOG_TRACE, + "Blocking lock: {pinode=%p, basename=%s}", pinode, basename); lock->frame = frame; @@ -550,8 +552,8 @@ __unlock_name (pl_inode_t *pinode, const char *basename, entrylk_type type) ret_lock = lock; } } else { - gf_log ("locks", GF_LOG_ERROR, - "unlock for a non-existing lock!"); + gf_log ("locks", GF_LOG_DEBUG, + "Unlock for a non-existing lock!"); goto out; } @@ -575,8 +577,8 @@ __grant_blocked_entry_locks (xlator_t *this, pl_inode_t *pl_inode, /* TODO: error checking */ - gf_log ("locks", GF_LOG_DEBUG, - "trying to unblock: {pinode=%p, basename=%s}", + gf_log ("locks", GF_LOG_TRACE, + "Trying to unblock: {pinode=%p, basename=%s}", pl_inode, bl->basename); bl_ret = __lock_name (pl_inode, bl->basename, bl->type, @@ -703,7 +705,7 @@ pl_entrylk (call_frame_t *frame, xlator_t *this, pinode = pl_inode_get (this, loc->inode); if (!pinode) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); op_errno = ENOMEM; goto out; } @@ -717,8 +719,8 @@ pl_entrylk (call_frame_t *frame, xlator_t *this, all locks from this transport */ - gf_log (this->name, GF_LOG_DEBUG, - "releasing locks for transport %p", transport); + gf_log (this->name, GF_LOG_TRACE, + "Releasing locks for transport %p", transport); release_entry_locks_for_transport (this, pinode, transport); op_ret = 0; @@ -773,7 +775,8 @@ pl_entrylk (call_frame_t *frame, xlator_t *this, default: gf_log (this->name, GF_LOG_ERROR, - "unexpected case!"); + "Unexpected case in entrylk (cmd=%d). Please send" + "a bug report to gluster-devel@nongnu.org", cmd); goto out; } @@ -812,7 +815,7 @@ pl_fentrylk (call_frame_t *frame, xlator_t *this, pinode = pl_inode_get (this, fd->inode); if (!pinode) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory :("); goto out; } @@ -825,8 +828,8 @@ pl_fentrylk (call_frame_t *frame, xlator_t *this, all locks from this transport */ - gf_log (this->name, GF_LOG_DEBUG, - "releasing locks for transport %p", transport); + gf_log (this->name, GF_LOG_TRACE, + "Releasing locks for transport %p", transport); release_entry_locks_for_transport (this, pinode, transport); op_ret = 0; @@ -876,8 +879,10 @@ pl_fentrylk (call_frame_t *frame, xlator_t *this, break; default: - gf_log (this->name, GF_LOG_ERROR, - "unexpected case!"); + gf_log (this->name, GF_LOG_DEBUG, + "Unexpected case in fentrylk (cmd=%d). " + "Please send a bug report to gluster-devel@nongnu.org", + cmd); goto out; } diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 09823b46d31..271fda64a61 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -130,7 +130,7 @@ truncate_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, pl_inode = pl_inode_get (this, inode); if (!pl_inode) { gf_log (this->name, GF_LOG_ERROR, - "unable to get pl_inode from %p", inode); + "Out of memory."); op_errno = ENOMEM; goto unwind; } @@ -176,7 +176,7 @@ pl_truncate (call_frame_t *frame, xlator_t *this, local = CALLOC (1, sizeof (struct _truncate_ops)); if (!local) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); goto unwind; } @@ -207,7 +207,7 @@ pl_ftruncate (call_frame_t *frame, xlator_t *this, local = CALLOC (1, sizeof (struct _truncate_ops)); if (!local) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); goto unwind; } @@ -279,7 +279,7 @@ pl_flush (call_frame_t *frame, xlator_t *this, pl_inode = pl_inode_get (this, fd->inode); if (!pl_inode) { - gf_log (this->name, GF_LOG_ERROR, "returning EBADFD"); + gf_log (this->name, GF_LOG_DEBUG, "Could not get inode."); STACK_UNWIND (frame, -1, EBADFD); return 0; } @@ -471,7 +471,7 @@ pl_readv (call_frame_t *frame, xlator_t *this, rw = CALLOC (1, sizeof (*rw)); if (!rw) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); op_errno = ENOMEM; op_ret = -1; goto unlock; @@ -481,7 +481,7 @@ pl_readv (call_frame_t *frame, xlator_t *this, fd, size, offset); if (!rw->stub) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); op_errno = ENOMEM; op_ret = -1; free (rw); @@ -566,7 +566,7 @@ pl_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, rw = CALLOC (1, sizeof (*rw)); if (!rw) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); op_errno = ENOMEM; op_ret = -1; goto unlock; @@ -577,7 +577,7 @@ pl_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, iobref); if (!rw->stub) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); op_errno = ENOMEM; op_ret = -1; free (rw); @@ -630,7 +630,7 @@ pl_lk (call_frame_t *frame, xlator_t *this, pl_inode = pl_inode_get (this, fd->inode); if (!pl_inode) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); op_ret = -1; op_errno = ENOMEM; goto unwind; @@ -639,7 +639,7 @@ pl_lk (call_frame_t *frame, xlator_t *this, reqlock = new_posix_lock (flock, transport, client_pid); if (!reqlock) { gf_log (this->name, GF_LOG_ERROR, - "out of memory :("); + "Out of memory."); op_ret = -1; op_errno = ENOMEM; goto unwind; @@ -716,8 +716,8 @@ pl_forget (xlator_t *this, pl_inode = pl_inode_get (this, inode); if (!list_empty (&pl_inode->rw_list)) { - gf_log (this->name, GF_LOG_CRITICAL, - "pending R/W requests found, releasing."); + gf_log (this->name, GF_LOG_WARNING, + "Pending R/W requests found, releasing."); list_for_each_entry_safe (rw_req, rw_tmp, &pl_inode->rw_list, list) { @@ -728,7 +728,7 @@ pl_forget (xlator_t *this, } if (!list_empty (&pl_inode->ext_list)) { - gf_log (this->name, GF_LOG_CRITICAL, + gf_log (this->name, GF_LOG_WARNING, "Pending fcntl locks found, releasing."); list_for_each_entry_safe (ext_l, ext_tmp, &pl_inode->ext_list, @@ -740,7 +740,7 @@ pl_forget (xlator_t *this, } if (!list_empty (&pl_inode->int_list)) { - gf_log (this->name, GF_LOG_CRITICAL, + gf_log (this->name, GF_LOG_WARNING, "Pending inode locks found, releasing."); list_for_each_entry_safe (int_l, int_tmp, &pl_inode->int_list, @@ -752,7 +752,7 @@ pl_forget (xlator_t *this, } if (!list_empty (&pl_inode->dir_list)) { - gf_log (this->name, GF_LOG_CRITICAL, + gf_log (this->name, GF_LOG_WARNING, "Pending entry locks found, releasing."); list_for_each_entry_safe (entry_l, entry_tmp, @@ -777,14 +777,14 @@ init (xlator_t *this) data_t *mandatory = NULL; if (!this->children || this->children->next) { - gf_log (this->name, GF_LOG_ERROR, + gf_log (this->name, GF_LOG_CRITICAL, "FATAL: posix-locks should have exactly one child"); return -1; } if (!this->parents) { gf_log (this->name, GF_LOG_WARNING, - "dangling volume. check volfile "); + "Volume is dangling. Please check the volume file."); } trav = this->children; @@ -792,8 +792,9 @@ init (xlator_t *this) trav = trav->xlator->children; if (strncmp ("storage/", trav->xlator->type, 8)) { - gf_log (this->name, GF_LOG_ERROR, - "'posix-locks' not loaded over storage translator"); + gf_log (this->name, GF_LOG_CRITICAL, + "'locks' translator is not loaded over a storage " + "translator"); return -1; } @@ -804,8 +805,8 @@ init (xlator_t *this) if (gf_string2boolean (mandatory->data, &priv->mandatory) == -1) { gf_log (this->name, GF_LOG_ERROR, - "'mandatory-locks' takes only boolean " - "options"); + "'mandatory-locks' takes on only boolean " + "values."); return -1; } } -- cgit