src/client_admin.c | 10 ++++++----
src/main.c | 9 +++++++--
2 files changed, 13 insertions(+), 6 deletions(-)
New commits:
commit 21101ea0bfdf186e4946e7a25ad6484e51072713
Author: David Teigland <teigland(a)redhat.com>
Date: Mon May 9 16:37:12 2011 -0500
sanlock: fix inquire of dead pid
return an error if the pid is dead by the time
we get to process the inquire
diff --git a/src/main.c b/src/main.c
index c0b36d8..911379a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1192,7 +1192,7 @@ static void cmd_inquire(struct cmd_args *ca)
struct sm_header h;
struct token *token;
struct client *cl;
- char *state, *str;
+ char *state = NULL, *str;
int state_maxlen = 0, state_strlen = 0;
int res_count = 0, cat_count = 0;
int fd, i, rv, pid_dead;
@@ -1209,6 +1209,11 @@ static void cmd_inquire(struct cmd_args *ca)
pthread_mutex_lock(&cl->mutex);
+ if (cl->pid_dead) {
+ result = -ESTALE;
+ goto done;
+ }
+
for (i = 0; i < SANLK_MAX_RESOURCES; i++) {
if (cl->tokens[i])
res_count++;
commit 2e8b735e75c056ca25983fe209529e7167027f45
Author: David Teigland <teigland(a)redhat.com>
Date: Mon May 9 16:01:08 2011 -0500
sanlock: client status output format changes
diff --git a/src/client_admin.c b/src/client_admin.c
index c488b50..fc3fa4a 100644
--- a/src/client_admin.c
+++ b/src/client_admin.c
@@ -111,8 +111,9 @@ static void status_lockspace(int fd, struct sanlk_state *st, char
*str, int debu
rv = recv(fd, &lockspace, sizeof(lockspace), MSG_WAITALL);
- printf("lockspace %.48s host_id %llu %s:%llu\n",
- lockspace.name, (unsigned long long)lockspace.host_id,
+ printf(" lockspace %.48s:%llu:%s:%llu\n",
+ lockspace.name,
+ (unsigned long long)lockspace.host_id,
lockspace.host_id_disk.path,
(unsigned long long)lockspace.host_id_disk.offset);
@@ -137,14 +138,15 @@ static void status_resource(int fd, struct sanlk_state *st, char
*str, int debug
rv = recv(fd, &resource, sizeof(resource), MSG_WAITALL);
- printf(" %.48s %.48s\n", resource.lockspace_name, resource.name);
+ printf(" resource %.48s:%.48s", resource.lockspace_name, resource.name);
for (i = 0; i < resource.num_disks; i++) {
rv = recv(fd, &disk, sizeof(disk), MSG_WAITALL);
- printf(" %s:%llu\n",
+ printf(":%s:%llu",
disk.path, (unsigned long long)disk.offset);
}
+ printf("\n");
if (st->str_len && debug)
print_debug(str, st->str_len);
diff --git a/src/main.c b/src/main.c
index 1c3a8e9..c0b36d8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1554,7 +1554,7 @@ static int print_daemon_state(char *str)
"host_id_renewal=%d "
"host_id_renewal_fail=%d "
"host_id_renewal_warn=%d "
- "host_id_timeout=%d ",
+ "host_id_timeout=%d",
to.use_aio,
to.io_timeout_seconds,
to.host_id_renewal_seconds,