summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorPavan Sondur <pavan@gluster.com>2009-12-03 14:51:10 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-03 12:45:11 -0800
commit120b446967ef33701a31d0da23324177922a3d73 (patch)
tree1331a92ed1dd0692dbec80f73ac40481da98dca5 /xlators/features
parent83487d024bcfe671ef83752c8c3a8b56b8dcee2b (diff)
features/locks: Changes in log messages reflecting lk-owner.
Signed-off-by: Pavan Vilas Sondur <pavan@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 336 (Use lock owner field from fuse in locks) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=336
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/locks/src/common.c18
-rw-r--r--xlators/features/locks/src/entrylk.c6
-rw-r--r--xlators/features/locks/src/inodelk.c31
-rw-r--r--xlators/features/locks/src/posix.c9
4 files changed, 38 insertions, 26 deletions
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c
index f535845..58b95d2 100644
--- a/xlators/features/locks/src/common.c
+++ b/xlators/features/locks/src/common.c
@@ -120,8 +120,9 @@ __pl_inode_is_empty (pl_inode_t *pl_inode)
void
pl_print_locker (char *str, int size, xlator_t *this, call_frame_t *frame)
{
- snprintf (str, size, "Pid=%llu, Transport=%p, Frame=%llu",
+ snprintf (str, size, "Pid=%llu, lk-owner=%llu, Transport=%p, Frame=%llu",
(unsigned long long) frame->root->pid,
+ (unsigned long long) frame->root->lk_owner,
(void *)frame->root->trans,
(unsigned long long) frame->root->unique);
}
@@ -162,7 +163,8 @@ pl_print_lockee (char *str, int size, fd_t *fd, loc_t *loc)
void
-pl_print_lock (char *str, int size, int cmd, struct flock *flock)
+pl_print_lock (char *str, int size, int cmd,
+ struct flock *flock, uint64_t owner)
{
char *cmd_str = NULL;
char *type_str = NULL;
@@ -209,10 +211,12 @@ pl_print_lock (char *str, int size, int cmd, struct flock *flock)
break;
}
- snprintf (str, size, "cmd=%s, type=%s, start=%llu, len=%llu, pid=%llu",
+ snprintf (str, size, "lock=FCNTL, cmd=%s, type=%s, "
+ "start=%llu, len=%llu, pid=%llu, lk-owner=%llu",
cmd_str, type_str, (unsigned long long) flock->l_start,
(unsigned long long) flock->l_len,
- (unsigned long long) flock->l_pid);
+ (unsigned long long) flock->l_pid,
+ (unsigned long long) owner);
}
@@ -235,7 +239,7 @@ pl_trace_in (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc,
if (domain)
pl_print_inodelk (pl_lock, 256, cmd, flock, domain);
else
- pl_print_lock (pl_lock, 256, cmd, flock);
+ pl_print_lock (pl_lock, 256, cmd, flock, frame->root->lk_owner);
gf_log (this->name, GF_LOG_NORMAL,
"[REQUEST] Locker = {%s} Lockee = {%s} Lock = {%s}",
@@ -285,7 +289,7 @@ pl_trace_out (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc,
if (domain)
pl_print_inodelk (pl_lock, 256, cmd, flock, domain);
else
- pl_print_lock (pl_lock, 256, cmd, flock);
+ pl_print_lock (pl_lock, 256, cmd, flock, frame->root->lk_owner);
pl_print_verdict (verdict, 32, op_ret, op_errno);
@@ -315,7 +319,7 @@ pl_trace_block (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc,
if (domain)
pl_print_inodelk (pl_lock, 256, cmd, flock, domain);
else
- pl_print_lock (pl_lock, 256, cmd, flock);
+ pl_print_lock (pl_lock, 256, cmd, flock, frame->root->lk_owner);
gf_log (this->name, GF_LOG_NORMAL,
"[BLOCKED] Locker = {%s} Lockee = {%s} Lock = {%s}",
diff --git a/xlators/features/locks/src/entrylk.c b/xlators/features/locks/src/entrylk.c
index 6fc45bc..b83044b 100644
--- a/xlators/features/locks/src/entrylk.c
+++ b/xlators/features/locks/src/entrylk.c
@@ -188,7 +188,7 @@ pl_print_entrylk (char *str, int size, entrylk_cmd cmd, entrylk_type type,
break;
}
- snprintf (str, size, "cmd=%s, type=%s, basename=%s, domain: %s",
+ snprintf (str, size, "lock=ENTRYLK, cmd=%s, type=%s, basename=%s, domain: %s",
cmd_str, type_str, basename, domain);
}
@@ -325,7 +325,7 @@ __lock_name (pl_inode_t *pinode, const char *basename, entrylk_type type,
trans = frame->root->trans;
client_pid = frame->root->pid;
- owner = (uint64_t)frame->root;
+ owner = (uint64_t)(long)frame->root;
lock = new_entrylk_lock (pinode, basename, type, trans, client_pid, owner, dom->domain);
if (!lock) {
@@ -618,7 +618,7 @@ pl_common_entrylk (call_frame_t *frame, xlator_t *this,
entrylk_trace_in (this, frame, volume, fd, loc, basename, cmd, type);
pid = frame->root->pid;
- owner = (uint64_t) frame->root;
+ owner = (uint64_t)(long) frame->root;
transport = frame->root->trans;
if (pid == 0) {
diff --git a/xlators/features/locks/src/inodelk.c b/xlators/features/locks/src/inodelk.c
index 860f038..0196044 100644
--- a/xlators/features/locks/src/inodelk.c
+++ b/xlators/features/locks/src/inodelk.c
@@ -103,7 +103,8 @@ pl_print_inodelk (char *str, int size, int cmd, struct flock *flock, const char
break;
}
- snprintf (str, size, "cmd=%s, type=%s, domain: %s, start=%llu, len=%llu, pid=%llu",
+ snprintf (str, size, "lock=INODELK, cmd=%s, type=%s, "
+ "domain: %s, start=%llu, len=%llu, pid=%llu",
cmd_str, type_str, domain,
(unsigned long long) flock->l_start,
(unsigned long long) flock->l_len,
@@ -235,7 +236,7 @@ __lock_inodelk (xlator_t *this, pl_inode_t *pl_inode, pl_inode_lock_t *lock,
gf_log (this->name, GF_LOG_TRACE,
"Lock is grantable, but blocking to prevent starvation");
gf_log (this->name, GF_LOG_TRACE,
- "%s (pid=%d) lk-owner:%"PRIu64" %"PRId64" - %"PRId64" => Blocked",
+ "%s (pid=%d) (lk-owner=%"PRIu64") %"PRId64" - %"PRId64" => Blocked",
lock->fl_type == F_UNLCK ? "Unlock" : "Lock",
lock->client_pid,
lock->owner,
@@ -322,7 +323,7 @@ __grant_blocked_inode_locks (xlator_t *this, pl_inode_t *pl_inode, pl_dom_list_t
if (bl_ret == 0) {
gf_log (this->name, GF_LOG_TRACE,
- "%s (pid=%d) lk-owner:%"PRIu64" %"PRId64" - %"PRId64" => Granted",
+ "%s (pid=%d) (lk-owner=%"PRIu64") %"PRId64" - %"PRId64" => Granted",
bl->fl_type == F_UNLCK ? "Unlock" : "Lock",
bl->client_pid,
bl->owner,
@@ -390,9 +391,10 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom,
gf_log (this->name, GF_LOG_TRACE,
"releasing lock on %s held by "
- "{transport=%p, pid=%"PRId64"}",
+ "{transport=%p, pid=%"PRId64" lk-owner=%"PRIu64"}",
path, trans,
- (uint64_t) l->client_pid);
+ (uint64_t) l->client_pid,
+ l->owner);
list_add (&l->blocked_locks, &released);
@@ -414,9 +416,10 @@ release_inode_locks_of_transport (xlator_t *this, pl_dom_list_t *dom,
gf_log (this->name, GF_LOG_TRACE,
"releasing lock on %s held by "
- "{transport=%p, pid=%"PRId64"}",
+ "{transport=%p, pid=%"PRId64" lk-owner=%"PRIu64"}",
path, trans,
- (uint64_t) l->client_pid);
+ (uint64_t) l->client_pid,
+ l->owner);
__destroy_inode_lock (l);
@@ -454,7 +457,7 @@ pl_inode_setlk (xlator_t *this, pl_inode_t *pl_inode, pl_inode_lock_t *lock,
ret = __lock_inodelk (this, pl_inode, lock, can_block, dom);
if (ret == 0)
gf_log (this->name, GF_LOG_TRACE,
- "%s (pid=%d) lk-owner:%"PRIu64" %"PRId64" - %"PRId64" => OK",
+ "%s (pid=%d) (lk-owner=%"PRIu64") %"PRId64" - %"PRId64" => OK",
lock->fl_type == F_UNLCK ? "Unlock" : "Lock",
lock->client_pid,
lock->owner,
@@ -463,7 +466,7 @@ pl_inode_setlk (xlator_t *this, pl_inode_t *pl_inode, pl_inode_lock_t *lock,
if (ret == -EAGAIN)
gf_log (this->name, GF_LOG_TRACE,
- "%s (pid=%d) lk-owner:%"PRIu64" %"PRId64" - %"PRId64" => NOK",
+ "%s (pid=%d) (lk-owner=%"PRIu64") %"PRId64" - %"PRId64" => NOK",
lock->fl_type == F_UNLCK ? "Unlock" : "Lock",
lock->client_pid,
lock->owner,
@@ -553,7 +556,7 @@ pl_common_inodelk (call_frame_t *frame, xlator_t *this,
transport = frame->root->trans;
client_pid = frame->root->pid;
- owner = (uint64_t) frame->root;
+ owner = (uint64_t) (long)frame->root;
pinode = pl_inode_get (this, inode);
if (!pinode) {
@@ -666,10 +669,12 @@ __get_inodelk_count (xlator_t *this, pl_inode_t *pl_inode)
gf_log (this->name, GF_LOG_DEBUG,
" XATTR DEBUG"
- " domain: %s %s (pid=%d) %"PRId64" - %"PRId64" state = Active",
+ " domain: %s %s (pid=%d) (lk-owner=%"PRIu64") %"PRId64" - %"PRId64" "
+ "state = Active",
dom->domain,
lock->fl_type == F_UNLCK ? "Unlock" : "Lock",
lock->client_pid,
+ lock->owner,
lock->user_flock.l_start,
lock->user_flock.l_len);
@@ -680,10 +685,12 @@ __get_inodelk_count (xlator_t *this, pl_inode_t *pl_inode)
gf_log (this->name, GF_LOG_DEBUG,
" XATTR DEBUG"
- " domain: %s %s (pid=%d) %"PRId64" - %"PRId64" state = Blocked",
+ " domain: %s %s (pid=%d) (lk-owner=%"PRIu64") %"PRId64" - %"PRId64" "
+ "state = Blocked",
dom->domain,
lock->fl_type == F_UNLCK ? "Unlock" : "Lock",
lock->client_pid,
+ lock->owner,
lock->user_flock.l_start,
lock->user_flock.l_len);
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 6744855..f3b95e0 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -237,7 +237,7 @@ unwind:
static void
__delete_locks_of_owner (pl_inode_t *pl_inode,
- transport_t *transport, pid_t pid)
+ transport_t *transport, uint64_t owner)
{
posix_lock_t *tmp = NULL;
posix_lock_t *l = NULL;
@@ -246,7 +246,7 @@ __delete_locks_of_owner (pl_inode_t *pl_inode,
list_for_each_entry_safe (l, tmp, &pl_inode->ext_list, list) {
if ((l->transport == transport)
- && (l->client_pid == pid)) {
+ && (l->owner == owner)) {
__delete_lock (pl_inode, l);
__destroy_lock (l);
}
@@ -288,7 +288,7 @@ pl_flush (call_frame_t *frame, xlator_t *this,
pthread_mutex_lock (&pl_inode->mutex);
{
__delete_locks_of_owner (pl_inode, frame->root->trans,
- frame->root->pid);
+ frame->root->lk_owner);
}
pthread_mutex_unlock (&pl_inode->mutex);
@@ -804,9 +804,10 @@ __get_posixlk_count (xlator_t *this, pl_inode_t *pl_inode)
gf_log (this->name, GF_LOG_DEBUG,
" XATTR DEBUG"
- "%s (pid=%d) %"PRId64" - %"PRId64" state: %s",
+ "%s (pid=%d) (lk-owner=%"PRIu64") %"PRId64" - %"PRId64" state: %s",
lock->fl_type == F_UNLCK ? "Unlock" : "Lock",
lock->client_pid,
+ lock->owner,
lock->user_flock.l_start,
lock->user_flock.l_len,
lock->blocked == 1 ? "Blocked" : "Active");