diff options
author | David Teigland <teigland@redhat.com> | 2019-08-05 14:08:52 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2019-08-05 14:08:52 -0500 |
commit | 892584ee75a65518318aec1277627acd436401c0 (patch) | |
tree | c738861d28689fd8623a9c870e259829a6dae296 | |
parent | 5ddd1ead2dcaf9594a025a15986b8bac573c81b2 (diff) | |
download | lvm2-dev-dct-clvmd-lvm-debug.tar.gz |
clvmd: add L option to enable lvm debuggingdev-dct-clvmd-lvm-debug
-rw-r--r-- | daemons/clvmd/clvmd.c | 8 | ||||
-rw-r--r-- | daemons/clvmd/lvm-functions.c | 12 |
2 files changed, 19 insertions, 1 deletions
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); |