]> sourceware.org Git - lvm2.git/commitdiff
lvmetad: define special update in progress string
authorDavid Teigland <teigland@redhat.com>
Thu, 19 May 2016 21:19:38 +0000 (16:19 -0500)
committerDavid Teigland <teigland@redhat.com>
Tue, 7 Jun 2016 15:17:00 +0000 (10:17 -0500)
daemons/lvmetad/lvmetad-client.h
lib/cache/lvmetad.c

index 1376e6bfe53c58cf80817317ab0eeb4c09f2004c..47eb6b47f4ff85632b0612e187c99285962cedc6 100644 (file)
@@ -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"
index 6f914b2e1cd48aec8b95c004c5bd129ccd9f93f0..a87c952aeb383bd5eec4e5202961b6c565353065 100644 (file)
@@ -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.");
This page took 0.045124 seconds and 5 git commands to generate.