diff options
author | David Teigland <teigland@redhat.com> | 2014-12-08 13:31:21 -0600 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2014-12-19 16:29:58 -0600 |
commit | a4d7c846ce21fa45834b3015f29b8e1bc0feab7c (patch) | |
tree | f82bc1eb3607ac84bd7cedff17eeb9bea507b102 | |
parent | 5139ca24c0b223d3543660db624dd3fb969321c5 (diff) | |
download | lvm2-a4d7c846ce21fa45834b3015f29b8e1bc0feab7c.tar.gz |
lvmlockd: pass cmd name to daemon
It's helpful to see the command name being processed.
-rw-r--r-- | lib/locking/lvmlockd.c | 5 | ||||
-rw-r--r-- | lib/misc/lvm-globals.c | 5 | ||||
-rw-r--r-- | lib/misc/lvm-globals.h | 1 |
3 files changed, 10 insertions, 1 deletions
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c index aeef5ddbb..521f937c1 100644 --- a/lib/locking/lvmlockd.c +++ b/lib/locking/lvmlockd.c @@ -226,7 +226,7 @@ static int _lockd_request(struct cmd_context *cmd, int *result, uint32_t *result_flags) { - const char *cmd_name = "unknown"; /* FIXME: setting this would help debugging */ + const char *cmd_name = get_cmd_name(); daemon_reply reply; int pid = getpid(); @@ -243,6 +243,9 @@ static int _lockd_request(struct cmd_context *cmd, /* cmd and pid are passed for informational and debugging purposes */ + if (!cmd_name || !cmd_name[0]) + cmd_name = "none"; + if (vg_name && lv_name) { reply = _lockd_send(req_name, "cmd = %s", cmd_name, diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c index ee192b026..e5351f8f2 100644 --- a/lib/misc/lvm-globals.c +++ b/lib/misc/lvm-globals.c @@ -181,6 +181,11 @@ void set_cmd_name(const char *cmd) _cmd_name[sizeof(_cmd_name) - 1] = '\0'; } +const char *get_cmd_name(void) +{ + return _cmd_name; +} + void set_sysfs_dir_path(const char *path) { strncpy(_sysfs_dir_path, path, sizeof(_sysfs_dir_path) - 1); diff --git a/lib/misc/lvm-globals.h b/lib/misc/lvm-globals.h index 4af713bd3..d2ae98648 100644 --- a/lib/misc/lvm-globals.h +++ b/lib/misc/lvm-globals.h @@ -49,6 +49,7 @@ void init_detect_internal_vg_cache_corruption(int detect); void init_retry_deactivation(int retry); void set_cmd_name(const char *cmd_name); +const char *get_cmd_name(void); void set_sysfs_dir_path(const char *path); int test_mode(void); |