mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-25 21:57:45 +03:00
lvmetad: Fix an endless wait loop introduced in c13f5dbb.
This commit is contained in:
parent
a2614c6866
commit
a3615f3149
6
lib/cache/lvmetad.c
vendored
6
lib/cache/lvmetad.c
vendored
@ -142,7 +142,7 @@ static daemon_reply _lvmetad_send(const char *id, ...)
|
||||
daemon_reply repl;
|
||||
daemon_request req;
|
||||
int try = 0;
|
||||
int time = 0, wait;
|
||||
int time = 0, wait, sleep = 1;
|
||||
|
||||
retry:
|
||||
req = daemon_request_make(id);
|
||||
@ -172,14 +172,16 @@ retry:
|
||||
* the update, we back off for a short while (0.2-2 seconds) and
|
||||
* try again.
|
||||
*/
|
||||
if (!strcmp(daemon_reply_str(repl, "expected", ""), "update in progress") || try % 5) {
|
||||
if (!strcmp(daemon_reply_str(repl, "expected", ""), "update in progress") || sleep) {
|
||||
wait = 50000 + random() % 450000; /* 0.05 - 0.5s */
|
||||
time += wait;
|
||||
usleep( wait );
|
||||
-- sleep;
|
||||
} else {
|
||||
/* If the re-scan fails here, we try again later. */
|
||||
lvmetad_pvscan_all_devs(_lvmetad_cmd, NULL);
|
||||
++ try;
|
||||
sleep = 5;
|
||||
}
|
||||
daemon_reply_destroy(repl);
|
||||
goto retry;
|
||||
|
Loading…
x
Reference in New Issue
Block a user