summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-05-19 16:19:38 -0500
committerDavid Teigland <teigland@redhat.com>2016-06-07 10:17:00 -0500
commit0e7f352c70decb779508b038a22e87c8e3f58b61 (patch)
tree506f04d7fc055564f662ee0e198a279ba4e00ca4
parent7ae05adf462b8de4428f32600fb43583dce5009a (diff)
downloadlvm2-0e7f352c70decb779508b038a22e87c8e3f58b61.tar.gz
lvmetad: define special update in progress string
-rw-r--r--daemons/lvmetad/lvmetad-client.h2
-rw-r--r--lib/cache/lvmetad.c12
2 files changed, 8 insertions, 6 deletions
diff --git a/daemons/lvmetad/lvmetad-client.h b/daemons/lvmetad/lvmetad-client.h
index 1376e6bfe..47eb6b47f 100644
--- a/daemons/lvmetad/lvmetad-client.h
+++ b/daemons/lvmetad/lvmetad-client.h
@@ -19,6 +19,8 @@
#define LVMETAD_SOCKET DEFAULT_RUN_DIR "/lvmetad.socket"
+#define LVMETAD_TOKEN_UPDATE_IN_PROGRESS "update in progress"
+
#define LVMETAD_DISABLE_REASON_DIRECT "DIRECT"
#define LVMETAD_DISABLE_REASON_LVM1 "LVM1"
#define LVMETAD_DISABLE_REASON_DUPLICATES "DUPLICATES"
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 6f914b2e1..a87c952ae 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -286,7 +286,7 @@ retry:
* the update message so that callers could detect when a rescan has
* stalled while updating lvmetad.
*/
- if (!strcmp(daemon_token, "update in progress")) {
+ if (!strcmp(daemon_token, LVMETAD_TOKEN_UPDATE_IN_PROGRESS)) {
if (!(now = _monotonic_seconds()))
goto fail;
@@ -370,7 +370,7 @@ retry:
if (!(daemon_token = daemon_reply_str(reply, "token", NULL)))
goto out;
- if (!strcmp(daemon_token, "update in progress")) {
+ if (!strcmp(daemon_token, LVMETAD_TOKEN_UPDATE_IN_PROGRESS)) {
ret = 1;
if (!do_wait)
@@ -441,7 +441,7 @@ retry:
goto out;
if (!strcmp(daemon_reply_str(reply, "response", ""), "token_mismatch")) {
- if (!strcmp(daemon_reply_str(reply, "expected", ""), "update in progress")) {
+ if (!strcmp(daemon_reply_str(reply, "expected", ""), LVMETAD_TOKEN_UPDATE_IN_PROGRESS)) {
/*
* Another command is updating the lvmetad cache, and
* we cannot use lvmetad until the update is finished.
@@ -520,7 +520,7 @@ static int _token_update(int *replaced_update)
}
if ((prev_token = daemon_reply_str(reply, "prev_token", NULL))) {
- if (!strcmp(prev_token, "update in progress"))
+ if (!strcmp(prev_token, LVMETAD_TOKEN_UPDATE_IN_PROGRESS))
if (replaced_update)
*replaced_update = 1;
}
@@ -583,7 +583,7 @@ static int _lvmetad_handle_reply(daemon_reply reply, const char *id, const char
* See the description of the token mismatch errors in lvmetad_send.
*/
if (!strcmp(daemon_reply_str(reply, "response", ""), "token_mismatch")) {
- if (!strcmp(daemon_reply_str(reply, "expected", ""), "update in progress")) {
+ if (!strcmp(daemon_reply_str(reply, "expected", ""), LVMETAD_TOKEN_UPDATE_IN_PROGRESS)) {
/*
* lvmetad_send retried up to the limit and eventually
* printed a warning and gave up.
@@ -1739,7 +1739,7 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait)
}
future_token = _lvmetad_token;
- _lvmetad_token = (char *) "update in progress";
+ _lvmetad_token = (char *) LVMETAD_TOKEN_UPDATE_IN_PROGRESS;
if (!_token_update(&replaced_update)) {
log_error("Failed to update lvmetad which had an update in progress.");