nfsrahead: modify get_device_info logic (RHEL-108924)

Resolves: RHEL-108924
Signed-off-by: Steve Dickson <steved@redhat.com>
This commit is contained in:
Steve Dickson 2025-12-08 11:50:13 -05:00
parent 9f4884f92c
commit 46f3b7b607
2 changed files with 65 additions and 1 deletions

View File

@ -0,0 +1,60 @@
commit 162a0093a86411c4ce46d44660c57b98e4879701
Author: Thiago Becker <tbecker@redhat.com>
Date: Wed Sep 10 08:21:47 2025 -0500
nfsrahead: modify get_device_info logic
There are a few reports of failures by nfsrahead to set the read ahead
when the nfs mount information is not available when the udev event
fires. This was alleviated by retrying to read mountinfo multiple times,
but some cases where still failing to find the device information. To
further alleviate this issue, this patch adds a 50ms delay between
attempts. To not incur into unecessary delays, the logic in
get_device_info is reworked.
While we are in this, remove a second loop of reptitions of
get_device_info.
Signed-off-by: Thiago Becker <tbecker@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/tools/nfsrahead/main.c b/tools/nfsrahead/main.c
index 8a11cf1a..b7b889ff 100644
--- a/tools/nfsrahead/main.c
+++ b/tools/nfsrahead/main.c
@@ -117,9 +117,11 @@ out_free_device_info:
static int get_device_info(const char *device_number, struct device_info *device_info)
{
- int ret = ENOENT;
- for (int retry_count = 0; retry_count < 10 && ret != 0; retry_count++)
+ int ret = get_mountinfo(device_number, device_info, MOUNTINFO_PATH);
+ for (int retry_count = 0; retry_count < 5 && ret != 0; retry_count++) {
+ usleep(50000);
ret = get_mountinfo(device_number, device_info, MOUNTINFO_PATH);
+ }
return ret;
}
@@ -135,7 +137,7 @@ static int conf_get_readahead(const char *kind) {
int main(int argc, char **argv)
{
- int ret = 0, retry, opt;
+ int ret = 0, opt;
struct device_info device;
unsigned int readahead = 128, log_level, log_stderr = 0;
@@ -163,11 +165,7 @@ int main(int argc, char **argv)
if ((argc - optind) != 1)
xlog_err("expected the device number of a BDI; is udev ok?");
- for (retry = 0; retry <= 10; retry++ )
- if ((ret = get_device_info(argv[optind], &device)) == 0)
- break;
-
- if (ret != 0 || device.fstype == NULL) {
+ if ((ret = get_device_info(argv[optind], &device)) != 0 || device.fstype == NULL) {
xlog(D_GENERAL, "unable to find device %s\n", argv[optind]);
goto out;
}

View File

@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
Name: nfs-utils
URL: http://linux-nfs.org/
Version: 2.3.3
Release: 64%{?dist}
Release: 65%{?dist}
Epoch: 1
# group all 32bit related archs
@ -118,6 +118,7 @@ Patch060: nfs-utils-2.3.3-gssd-do-not-use-krb5_cc_initialize.patch
Patch061: nfs-utils-2.3.3-nfsiostat-fixes.patch
Patch062: nfs-utils-2.3.3-mountstats-fixes.patch
Patch063: nfs-utils-2.3.3-nfs-man-rdirplus.patch
Patch064: nfs-utils-2.3.3-nfsrahead-Modify-get_device_info-logic.patch
Patch100: nfs-utils-1.2.1-statdpath-man.patch
Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch
@ -396,6 +397,9 @@ fi
%{_libdir}/libnfsidmap.so
%changelog
* Mon Dec 8 2025 Steve Dickson <steved@redhat.com> 2.3.3-65
- nfsrahead: modify get_device_info logic (RHEL-108924)
* Tue May 20 2025 Scott Mayhew <smayhew@redhat.com> 2.3.3-64
- update rdirplus documentation on nfs(5) man page (RHEL-91253)