mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-24 17:57:48 +03:00
lvmetad: define special update in progress string
This commit is contained in:
parent
7ae05adf46
commit
0e7f352c70
@ -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"
|
||||
|
12
lib/cache/lvmetad.c
vendored
12
lib/cache/lvmetad.c
vendored
@ -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.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user