From 892584ee75a65518318aec1277627acd436401c0 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Mon, 5 Aug 2019 14:08:52 -0500 Subject: clvmd: add L option to enable lvm debugging --- daemons/clvmd/clvmd.c | 8 +++++++- daemons/clvmd/lvm-functions.c | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c index 829c5e5f8..508eae380 100644 --- a/daemons/clvmd/clvmd.c +++ b/daemons/clvmd/clvmd.c @@ -69,6 +69,8 @@ static unsigned max_csid_len; static unsigned max_cluster_message; static unsigned max_cluster_member_name_len; +int clvmd_debug_lvm; + static void _add_client(struct local_client *new_client, struct local_client *existing_client) { _local_client_count++; @@ -411,7 +413,7 @@ int main(int argc, char *argv[]) /* Deal with command-line arguments */ opterr = 0; optind = 0; - while ((opt = getopt_long(argc, argv, "Vhfd:t:RST:CI:E:", + while ((opt = getopt_long(argc, argv, "Vhfd:t:RST:CLI:E:", longopts, NULL)) != -1) { switch (opt) { case 'h': @@ -432,6 +434,10 @@ int main(int argc, char *argv[]) clusterwide_opt = 1; break; + case 'L': + clvmd_debug_lvm = 1; + break; + case 'd': debug_opt = DEBUG_STDERR; debug_arg = (debug_t) atoi(optarg); diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c index d6d395f01..3acb26701 100644 --- a/daemons/clvmd/lvm-functions.c +++ b/daemons/clvmd/lvm-functions.c @@ -38,6 +38,8 @@ static pthread_mutex_t lv_hash_lock; static pthread_mutex_t lvm_lock; static char last_error[1024]; +extern int clvmd_debug_lvm; + struct lv_info { int lock_id; int lock_mode; @@ -656,6 +658,11 @@ int do_refresh_cache(void) label_scan_destroy(cmd); /* destroys bcache (to close devs), keeps lvmcache */ dm_pool_empty(cmd->mem); + if (clvmd_debug_lvm) { + init_verbose(11); + init_debug(11); + } + pthread_mutex_unlock(&lvm_lock); return 0; @@ -909,6 +916,11 @@ int init_clvm(struct dm_hash_table *excl_uuid) check_config(); init_ignore_suspended_devices(1); + if (clvmd_debug_lvm) { + init_verbose(11); + init_debug(11); + } + /* Trap log messages so we can pass them back to the user */ init_log_fn(lvm2_log_fn); memlock_inc_daemon(cmd); -- cgit v1.2.1