diff options
author | David Teigland <teigland@redhat.com> | 2014-12-08 13:31:21 -0600 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2015-02-27 13:44:56 -0600 |
commit | 4b903245f0ab715841e5e528686cbe358a61acfb (patch) | |
tree | 4c3e9f772a461c5528b7d397d7d2c8ad19093772 | |
parent | 114d811d9648fbe155a0768e053ca0486edebb4e (diff) | |
download | lvm2-4b903245f0ab715841e5e528686cbe358a61acfb.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 854df5172..67e5d345b 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 64557882a..4fa07792e 100644 --- a/lib/misc/lvm-globals.c +++ b/lib/misc/lvm-globals.c @@ -193,6 +193,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 b25f4aed0..8628a890a 100644 --- a/lib/misc/lvm-globals.h +++ b/lib/misc/lvm-globals.h @@ -51,6 +51,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); |