diff options
author | Steve Dickson <steved@redhat.com> | 2022-04-19 11:11:20 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2022-04-19 15:50:29 -0400 |
commit | 170394f63f648eb46eca5c5c333ae56c3eb96397 (patch) | |
tree | d1b15ceab94155834fae2df1884f372a1f67523e | |
parent | 589b0f898a757b03c4573d65309df8f6e8d6c524 (diff) | |
download | nfs-utils-170394f63f648eb46eca5c5c333ae56c3eb96397.tar.gz |
nfsrahead: retry getting the device if it fails.
Sometimes the mountinfo entry is not available when nfsrahead is called,
leading to failure to set the readahead. Retry getting the device before
failing.
Signed-off-by: Thiago Becker <tbecker@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r-- | tools/nfsrahead/main.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/nfsrahead/main.c b/tools/nfsrahead/main.c index 1a312ac..b3af3aa 100644 --- a/tools/nfsrahead/main.c +++ b/tools/nfsrahead/main.c @@ -127,7 +127,7 @@ static int conf_get_readahead(const char *kind) { int main(int argc, char **argv) { - int ret = 0; + int ret = 0, retry; struct device_info device; unsigned int readahead = 128, verbose = 0, log_stderr = 0; char opt; @@ -154,7 +154,11 @@ int main(int argc, char **argv) if ((argc - optind) != 1) xlog_err("expected the device number of a BDI; is udev ok?"); - if ((ret = get_device_info(argv[optind], &device)) != 0) { + for (retry = 0; retry <= 10; retry++ ) + if ((ret = get_device_info(argv[optind], &device)) == 0) + break; + + if (ret != 0) { xlog(L_ERROR, "unable to find device %s\n", argv[optind]); goto out; } |