summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src/posix.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2011-09-30 17:40:26 +0530
committerVijay Bellur <vijay@gluster.com>2011-10-05 22:29:02 -0700
commit78dd69c4c732d3d74070118f0b6b708264d8fc0c (patch)
tree9155f7b13cc3113d27381c537b3bc6d55daa365b /xlators/features/locks/src/posix.c
parent9d062a1359994e4c035a413fc9c5aec28fa5e7ae (diff)
locks: Avoid printing blocked times for locks that were never blocked.
Change-Id: Ieedbfbe3ce2d4a87a8fe0e1a4322a1bb0549a2bf BUG: 3662 Reviewed-on: http://review.gluster.com/545 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/features/locks/src/posix.c')
-rw-r--r--xlators/features/locks/src/posix.c56
1 files changed, 39 insertions, 17 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 2afb3b07fcd..59e2199fb4b 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -1524,15 +1524,26 @@ pl_dump_lock (char *str, int size, struct gf_flock *flock,
break;
}
- if (active)
- snprintf (str, size, "type=%s, start=%llu, len=%llu, pid=%llu, lk-owner=%llu, transport=%p, "
- "blocked at %s, granted at %s",
- type_str, (unsigned long long) flock->l_start,
- (unsigned long long) flock->l_len,
- (unsigned long long) flock->l_pid,
- (unsigned long long) owner,
- trans, ctime (blkd_time), ctime (granted_time));
- else
+ if (active) {
+ if (blkd_time && *blkd_time == 0) {
+ snprintf (str, size, "type=%s, start=%llu, len=%llu, pid=%llu, lk-owner=%llu, transport=%p, "
+ "granted at %s",
+ type_str, (unsigned long long) flock->l_start,
+ (unsigned long long) flock->l_len,
+ (unsigned long long) flock->l_pid,
+ (unsigned long long) owner,
+ trans, ctime (granted_time));
+ } else {
+ snprintf (str, size, "type=%s, start=%llu, len=%llu, pid=%llu, lk-owner=%llu, transport=%p, "
+ "blocked at %s, granted at %s",
+ type_str, (unsigned long long) flock->l_start,
+ (unsigned long long) flock->l_len,
+ (unsigned long long) flock->l_pid,
+ (unsigned long long) owner,
+ trans, ctime (blkd_time), ctime (granted_time));
+ }
+ }
+ else {
snprintf (str, size, "type=%s, start=%llu, len=%llu, pid=%llu, lk-owner=%llu, transport=%p, "
"blocked at %s",
type_str, (unsigned long long) flock->l_start,
@@ -1540,6 +1551,7 @@ pl_dump_lock (char *str, int size, struct gf_flock *flock,
(unsigned long long) flock->l_pid,
(unsigned long long) owner,
trans, ctime (blkd_time));
+ }
}
@@ -1567,14 +1579,24 @@ __dump_entrylks (pl_inode_t *pl_inode)
gf_proc_dump_build_key(key,
"xlator.feature.locks.lock-dump.domain.entrylk",
"entrylk[%d](ACTIVE)", count );
- snprintf (tmp, 256," %s on %s pid = %llu, owner=%llu, transport=%p,"
- " blocked at %s, granted at %s",
- lock->type == ENTRYLK_RDLCK ? "ENTRYLK_RDLCK" :
- "ENTRYLK_WRLCK", lock->basename,
- (unsigned long long) lock->client_pid,
- (unsigned long long) lock->owner, lock->trans,
- ctime (&lock->blkd_time.tv_sec),
- ctime (&lock->granted_time.tv_sec));
+ if (lock->blkd_time.tv_sec == 0 && lock->blkd_time.tv_usec == 0) {
+ snprintf (tmp, 256," %s on %s pid = %llu, owner=%llu, transport=%p,"
+ " granted at %s",
+ lock->type == ENTRYLK_RDLCK ? "ENTRYLK_RDLCK" :
+ "ENTRYLK_WRLCK", lock->basename,
+ (unsigned long long) lock->client_pid,
+ (unsigned long long) lock->owner, lock->trans,
+ ctime (&lock->granted_time.tv_sec));
+ } else {
+ snprintf (tmp, 256," %s on %s pid = %llu, owner=%llu, transport=%p,"
+ " blocked at %s, granted at %s",
+ lock->type == ENTRYLK_RDLCK ? "ENTRYLK_RDLCK" :
+ "ENTRYLK_WRLCK", lock->basename,
+ (unsigned long long) lock->client_pid,
+ (unsigned long long) lock->owner, lock->trans,
+ ctime (&lock->blkd_time.tv_sec),
+ ctime (&lock->granted_time.tv_sec));
+ }
gf_proc_dump_write(key, tmp);