summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2018-11-30 15:49:03 -0600
committerDavid Teigland <teigland@redhat.com>2018-11-30 15:49:03 -0600
commit9764ee0b3f21ed717e1b6248ce4c41dd552bb0ec (patch)
tree730e8e1d686d074246fed276c514bd027a4f720c
parent322d4ed05e348c6d88f3cb880485e5777298c361 (diff)
downloadlvm2-9764ee0b3f21ed717e1b6248ce4c41dd552bb0ec.tar.gz
lvmetad: fix disabling in previous commit
it broke the case where a connection already exists.
-rw-r--r--lib/cache/lvmetad.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 1b48fd344..f068fc637 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -2978,7 +2978,7 @@ void lvmetad_set_disabled(struct cmd_context *cmd, const char *reason)
{
daemon_handle tmph = { .error = 0 };
daemon_reply reply;
- int dis = 0;
+ int tmp_con = 0;
/*
* If we were using lvmetad at the start of the command, but are not
@@ -2993,7 +2993,7 @@ void lvmetad_set_disabled(struct cmd_context *cmd, const char *reason)
log_warn("Failed to connect to lvmetad to disable.");
return;
}
- dis = 1;
+ tmp_con = 1;
} else {
/* We were never using lvmetad, don't start now. */
return;
@@ -3002,13 +3002,23 @@ void lvmetad_set_disabled(struct cmd_context *cmd, const char *reason)
log_debug_lvmetad("Sending lvmetad disabled %s", reason);
- reply = daemon_send_simple(tmph, "set_global_info",
+ if (tmp_con)
+ reply = daemon_send_simple(tmph, "set_global_info",
"token = %s", "skip",
"global_disable = " FMTd64, (int64_t)1,
"disable_reason = %s", reason,
"pid = " FMTd64, (int64_t)getpid(),
"cmd = %s", get_cmd_name(),
NULL);
+ else
+ reply = daemon_send_simple(_lvmetad, "set_global_info",
+ "token = %s", "skip",
+ "global_disable = " FMTd64, (int64_t)1,
+ "disable_reason = %s", reason,
+ "pid = " FMTd64, (int64_t)getpid(),
+ "cmd = %s", get_cmd_name(),
+ NULL);
+
if (reply.error)
log_error("Failed to send message to lvmetad %d", reply.error);
@@ -3017,7 +3027,7 @@ void lvmetad_set_disabled(struct cmd_context *cmd, const char *reason)
daemon_reply_destroy(reply);
- if (dis)
+ if (tmp_con)
daemon_close(tmph);
}