* master - lvmetad: Wait at least 80s for the initial scan.
@ 2014-03-25 15:39 Petr Rockai
2014-03-25 16:00 ` Hannes Reinecke
2014-03-26 10:16 ` Marian Csontos
0 siblings, 2 replies; 4+ messages in thread
From: Petr Rockai @ 2014-03-25 15:39 UTC (permalink / raw)
To: lvm-devel
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c13f5dbb2521901f723d4c40fd5992ee0b992d8d
Commit: c13f5dbb2521901f723d4c40fd5992ee0b992d8d
Parent: 65bbfdf74ddbb16579c4fa5fc76e1f51aee0da22
Author: Petr Rockai <prockai@redhat.com>
AuthorDate: Tue Mar 25 15:53:36 2014 +0100
Committer: Petr Rockai <prockai@redhat.com>
CommitterDate: Tue Mar 25 16:38:35 2014 +0100
lvmetad: Wait at least 80s for the initial scan.
---
lib/cache/lvmetad.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 040a790..3ee850c 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -142,6 +142,7 @@ static daemon_reply _lvmetad_send(const char *id, ...)
daemon_reply repl;
daemon_request req;
int try = 0;
+ int time = 0, wait;
retry:
req = daemon_request_make(id);
@@ -158,7 +159,7 @@ retry:
daemon_request_destroy(req);
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
* 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
* try again.
*/
- if (!strcmp(daemon_reply_str(repl, "expected", ""), "update in progress") || try % 5)
- usleep( 50000 + random() % 450000 ); /* 0.05 - 0.5s */
- else
+ if (!strcmp(daemon_reply_str(repl, "expected", ""), "update in progress") || try % 5) {
+ wait = 50000 + random() % 450000; /* 0.05 - 0.5s */
+ time += wait;
+ usleep( wait );
+ } else {
/* If the re-scan fails here, we try again later. */
lvmetad_pvscan_all_devs(_lvmetad_cmd, NULL);
- ++ try;
+ ++ try;
+ }
daemon_reply_destroy(repl);
goto retry;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* master - lvmetad: Wait at least 80s for the initial scan.
2014-03-25 15:39 master - lvmetad: Wait at least 80s for the initial scan Petr Rockai
@ 2014-03-25 16:00 ` Hannes Reinecke
2014-03-25 17:25 ` Petr Rockai
2014-03-26 10:16 ` Marian Csontos
1 sibling, 1 reply; 4+ messages in thread
From: Hannes Reinecke @ 2014-03-25 16:00 UTC (permalink / raw)
To: lvm-devel
On 03/25/2014 08:39 AM, Petr Rockai wrote:
> Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c13f5dbb2521901f723d4c40fd5992ee0b992d8d
> Commit: c13f5dbb2521901f723d4c40fd5992ee0b992d8d
> Parent: 65bbfdf74ddbb16579c4fa5fc76e1f51aee0da22
> Author: Petr Rockai <prockai@redhat.com>
> AuthorDate: Tue Mar 25 15:53:36 2014 +0100
> Committer: Petr Rockai <prockai@redhat.com>
> CommitterDate: Tue Mar 25 16:38:35 2014 +0100
>
> lvmetad: Wait at least 80s for the initial scan.
>
> ---
> lib/cache/lvmetad.c | 14 +++++++++-----
> 1 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
> index 040a790..3ee850c 100644
> --- a/lib/cache/lvmetad.c
> +++ b/lib/cache/lvmetad.c
> @@ -142,6 +142,7 @@ static daemon_reply _lvmetad_send(const char *id, ...)
> daemon_reply repl;
> daemon_request req;
> int try = 0;
> + int time = 0, wait;
>
> retry:
> req = daemon_request_make(id);
> @@ -158,7 +159,7 @@ retry:
> daemon_request_destroy(req);
>
> 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
> * 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
> * try again.
> */
> - if (!strcmp(daemon_reply_str(repl, "expected", ""), "update in progress") || try % 5)
> - usleep( 50000 + random() % 450000 ); /* 0.05 - 0.5s */
> - else
> + if (!strcmp(daemon_reply_str(repl, "expected", ""), "update in progress") || try % 5) {
> + wait = 50000 + random() % 450000; /* 0.05 - 0.5s */
> + time += wait;
> + usleep( wait );
> + } else {
> /* If the re-scan fails here, we try again later. */
> lvmetad_pvscan_all_devs(_lvmetad_cmd, NULL);
> - ++ try;
> + ++ try;
> + }
> daemon_reply_destroy(repl);
> goto retry;
> }
>
Can't we have a configuration setting for this?
I can imagine plenty of scenarios where the default value might not be
applicable, being either to short or too long.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare at suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: J. Hawn, J. Guild, F. Imend?rffer, HRB 16746 (AG N?rnberg)
^ permalink raw reply [flat|nested] 4+ messages in thread
* master - lvmetad: Wait at least 80s for the initial scan.
2014-03-25 16:00 ` Hannes Reinecke
@ 2014-03-25 17:25 ` Petr Rockai
0 siblings, 0 replies; 4+ messages in thread
From: Petr Rockai @ 2014-03-25 17:25 UTC (permalink / raw)
To: lvm-devel
Hi,
Hannes Reinecke <hare@suse.de> writes:
> Can't we have a configuration setting for this?
> I can imagine plenty of scenarios where the default value might not be
> applicable, being either to short or too long.
can you share such a scenario? This code path is currently hit in the
boot sequence (where a 90s timeout is already imposed by systemd, IIUIC)
and in the rare case where you change global_filter in lvm.conf. We hope
the boot code will be able to avoid it altogether, so eventually, the
only place where this can happen is when you modify global_filter and
then run two LVM commands in parallel. If the first takes more than 80s
to do its initial scanning, the second command will time out.
Petr
--
id' Ash = Ash; id' Dust = Dust; id' _ = undefined
^ permalink raw reply [flat|nested] 4+ messages in thread
* master - lvmetad: Wait at least 80s for the initial scan.
2014-03-25 15:39 master - lvmetad: Wait at least 80s for the initial scan Petr Rockai
2014-03-25 16:00 ` Hannes Reinecke
@ 2014-03-26 10:16 ` Marian Csontos
1 sibling, 0 replies; 4+ messages in thread
From: Marian Csontos @ 2014-03-26 10:16 UTC (permalink / raw)
To: lvm-devel
On 03/25/2014 04:39 PM, Petr Rockai wrote:
> Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c13f5dbb2521901f723d4c40fd5992ee0b992d8d
> Commit: c13f5dbb2521901f723d4c40fd5992ee0b992d8d
> Parent: 65bbfdf74ddbb16579c4fa5fc76e1f51aee0da22
> Author: Petr Rockai <prockai@redhat.com>
> AuthorDate: Tue Mar 25 15:53:36 2014 +0100
> Committer: Petr Rockai <prockai@redhat.com>
> CommitterDate: Tue Mar 25 16:38:35 2014 +0100
>
> lvmetad: Wait at least 80s for the initial scan.
>
> ---
> lib/cache/lvmetad.c | 14 +++++++++-----
> 1 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
> index 040a790..3ee850c 100644
> --- a/lib/cache/lvmetad.c
> +++ b/lib/cache/lvmetad.c
> @@ -142,6 +142,7 @@ static daemon_reply _lvmetad_send(const char *id, ...)
> daemon_reply repl;
> daemon_request req;
> int try = 0;
> + int time = 0, wait;
>
> retry:
> req = daemon_request_make(id);
> @@ -158,7 +159,7 @@ retry:
> daemon_request_destroy(req);
>
> 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
> * 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
> * try again.
> */
> - if (!strcmp(daemon_reply_str(repl, "expected", ""), "update in progress") || try % 5)
> - usleep( 50000 + random() % 450000 ); /* 0.05 - 0.5s */
> - else
> + if (!strcmp(daemon_reply_str(repl, "expected", ""), "update in progress") || try % 5) {
> + wait = 50000 + random() % 450000; /* 0.05 - 0.5s */
> + time += wait;
> + usleep( wait );
> + } else {
> /* If the re-scan fails here, we try again later. */
> lvmetad_pvscan_all_devs(_lvmetad_cmd, NULL);
> - ++ try;
> + ++ try;
> + }
This will never get behind try == 1.
> daemon_reply_destroy(repl);
> goto retry;
> }
>
> --
> lvm-devel mailing list
> lvm-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/lvm-devel
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-03-26 10:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-25 15:39 master - lvmetad: Wait at least 80s for the initial scan Petr Rockai
2014-03-25 16:00 ` Hannes Reinecke
2014-03-25 17:25 ` Petr Rockai
2014-03-26 10:16 ` Marian Csontos
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.