summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2014-12-08 13:31:21 -0600
committerDavid Teigland <teigland@redhat.com>2015-01-21 17:00:51 -0600
commitc5e2f496074b413b6d94b822c910445471bed424 (patch)
treeba33957bf65e564a93415a073dfd2ee72a281ccf
parent34970d9253214f067ad38031ef9a714990b6794f (diff)
downloadlvm2-c5e2f496074b413b6d94b822c910445471bed424.tar.gz
lvmlockd: pass cmd name to daemon
It's helpful to see the command name being processed.
-rw-r--r--lib/locking/lvmlockd.c5
-rw-r--r--lib/misc/lvm-globals.c5
-rw-r--r--lib/misc/lvm-globals.h1
3 files changed, 10 insertions, 1 deletions
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 330a1f046..0098de8f3 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);