summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2014-12-08 13:31:21 -0600
committerDavid Teigland <teigland@redhat.com>2015-03-05 14:26:25 -0600
commit3f67343a8163b48dbe29e1e938b1564c32a8cfb8 (patch)
tree75b5189a20ffbf2622178616de638c13e1997758
parent893fc69535e6fe21a9924774b5870d40c69c3067 (diff)
downloadlvm2-3f67343a8163b48dbe29e1e938b1564c32a8cfb8.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 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);