lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250812213759.403790-1-tbecker@redhat.com>
Date: Tue, 12 Aug 2025 18:37:59 -0300
From: tbecker@...hat.com
To: steved@...hat.com,
	linux-kernel@...r.kernel.org
Cc: Thiago Becker <tbecker@...hat.com>
Subject: [PATCH] nfsrahead: modify get_device_info logic

From: Thiago Becker <tbecker@...hat.com>

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@...hat.com>
---
 tools/nfsrahead/main.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

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;
 	}
-- 
2.43.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ