mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-25 21:57:45 +03:00
lvmetad: Wait at least 80s for the initial scan.
This commit is contained in:
parent
65bbfdf74d
commit
c13f5dbb25
14
lib/cache/lvmetad.c
vendored
14
lib/cache/lvmetad.c
vendored
@ -142,6 +142,7 @@ static daemon_reply _lvmetad_send(const char *id, ...)
|
|||||||
daemon_reply repl;
|
daemon_reply repl;
|
||||||
daemon_request req;
|
daemon_request req;
|
||||||
int try = 0;
|
int try = 0;
|
||||||
|
int time = 0, wait;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
req = daemon_request_make(id);
|
req = daemon_request_make(id);
|
||||||
@ -158,7 +159,7 @@ retry:
|
|||||||
daemon_request_destroy(req);
|
daemon_request_destroy(req);
|
||||||
|
|
||||||
if (!repl.error && !strcmp(daemon_reply_str(repl, "response", ""), "token_mismatch") &&
|
if (!repl.error && !strcmp(daemon_reply_str(repl, "response", ""), "token_mismatch") &&
|
||||||
try < 60 && !test_mode()) {
|
try < 10 && time < 80000000 && !test_mode()) {
|
||||||
/*
|
/*
|
||||||
* If another process is trying to scan, they might have the
|
* If another process is trying to scan, they might have the
|
||||||
* same future token id and it's better to wait and avoid doing
|
* same future token id and it's better to wait and avoid doing
|
||||||
@ -171,12 +172,15 @@ retry:
|
|||||||
* the update, we back off for a short while (0.2-2 seconds) and
|
* the update, we back off for a short while (0.2-2 seconds) and
|
||||||
* try again.
|
* try again.
|
||||||
*/
|
*/
|
||||||
if (!strcmp(daemon_reply_str(repl, "expected", ""), "update in progress") || try % 5)
|
if (!strcmp(daemon_reply_str(repl, "expected", ""), "update in progress") || try % 5) {
|
||||||
usleep( 50000 + random() % 450000 ); /* 0.05 - 0.5s */
|
wait = 50000 + random() % 450000; /* 0.05 - 0.5s */
|
||||||
else
|
time += wait;
|
||||||
|
usleep( wait );
|
||||||
|
} else {
|
||||||
/* If the re-scan fails here, we try again later. */
|
/* If the re-scan fails here, we try again later. */
|
||||||
lvmetad_pvscan_all_devs(_lvmetad_cmd, NULL);
|
lvmetad_pvscan_all_devs(_lvmetad_cmd, NULL);
|
||||||
++ try;
|
++ try;
|
||||||
|
}
|
||||||
daemon_reply_destroy(repl);
|
daemon_reply_destroy(repl);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user