Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 24e278e14a25367b8cb2fce8af484abd > files > 2

cman-2.0.115-96.el5_8.3.src.rpm

From 06bcbf23e42365e420c1db891defae110c841f0d Mon Sep 17 00:00:00 2001
From: Abhijith Das <adas@redhat.com>
Date: Thu, 22 Jul 2010 10:43:32 -0500
Subject: [PATCH] gfs_controld: Add extended information to 'group_tool dump plocks' (gfs)

The existing 'group_tool dump plocks' output doesn't include information about
unused and pending plocks. This patch adds this information to the output of
'group_tool dump plocks'.

Signed-off-by: Abhi Das <adas@redhat.com>

Resolves: rhbz#514264
---
 group/gfs_controld/plock.c |   56 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/group/gfs_controld/plock.c b/group/gfs_controld/plock.c
index b03e77f..a51a1fa 100644
--- a/group/gfs_controld/plock.c
+++ b/group/gfs_controld/plock.c
@@ -2361,6 +2361,7 @@ int dump_plocks(char *name, int fd)
 	struct posix_lock *po;
 	struct lock_waiter *w;
 	struct resource *r;
+	struct timeval now;
 	char line[MAXLINE];
 	int rv;
 
@@ -2371,29 +2372,56 @@ int dump_plocks(char *name, int fd)
 	if (!mg)
 		return -1;
 
+	gettimeofday(&now, NULL);
+
 	list_for_each_entry(r, &mg->resources, list) {
+		if (list_empty(&r->locks) &&
+		    list_empty(&r->waiters) &&
+		    list_empty(&r->pending)) {
+			snprintf(line, MAXLINE,
+				 "%llu rown %d unused_ms %llu\n",
+				 (unsigned long long)r->number, r->owner,
+				 (unsigned long long)time_diff_ms(&r->last_access,
+								  &now));
+
+			rv = do_write(fd, line, strlen(line));
+		}
+
 		list_for_each_entry(po, &r->locks, list) {
 			snprintf(line, MAXLINE,
-			      "%llu %s %llu-%llu nodeid %d pid %u owner %llx\n",
-			      (unsigned long long)r->number,
-			      po->ex ? "WR" : "RD",
-			      (unsigned long long)po->start,
-			      (unsigned long long)po->end,
-			      po->nodeid, po->pid,
-			      (unsigned long long)po->owner);
+				 "%llu %s %llu-%llu nodeid %d pid %u owner %llx rown %d\n",
+				 (unsigned long long)r->number,
+				 po->ex ? "WR" : "RD",
+				 (unsigned long long)po->start,
+				 (unsigned long long)po->end,
+				 po->nodeid, po->pid,
+				 (unsigned long long)po->owner, r->owner);
 
 			rv = do_write(fd, line, strlen(line));
 		}
 
 		list_for_each_entry(w, &r->waiters, list) {
 			snprintf(line, MAXLINE,
-			      "%llu WAITING %s %llu-%llu nodeid %d pid %u owner %llx\n",
-			      (unsigned long long)r->number,
-			      w->info.ex ? "WR" : "RD",
-			      (unsigned long long)w->info.start,
-			      (unsigned long long)w->info.end,
-			      w->info.nodeid, w->info.pid,
-			      (unsigned long long)w->info.owner);
+				 "%llu %s %llu-%llu nodeid %d pid %u owner %llx rown %d WAITING\n",
+				 (unsigned long long)r->number,
+				 w->info.ex ? "WR" : "RD",
+				 (unsigned long long)w->info.start,
+				 (unsigned long long)w->info.end,
+				 w->info.nodeid, w->info.pid,
+				 (unsigned long long)w->info.owner, r->owner);
+
+			rv = do_write(fd, line, strlen(line));
+		}
+
+		list_for_each_entry(w, &r->pending, list) {
+			snprintf(line, MAXLINE,
+				 "%llu %s %llu-%llu nodeid %d pid %u owner %llx rown %d PENDING\n",
+				 (unsigned long long)r->number,
+				 w->info.ex ? "WR" : "RD",
+				 (unsigned long long)w->info.start,
+				 (unsigned long long)w->info.end,
+				 w->info.nodeid, w->info.pid,
+				 (unsigned long long)w->info.owner, r->owner);
 
 			rv = do_write(fd, line, strlen(line));
 		}
-- 
1.6.2.5