Skip to contentSkip to conversation

Revert "nfsrahead: enable event-driven mountinfo monitoring and skip non-NFS devices"

PATCH In review Steve Dickson 2 participants 3 messages Mar 10

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "nfsrahead: enable event-driven mountinfo monitoring and skip non-NFS devices"

Process 869 (nfsrahead) of user 0 dumped core.
Module /usr/libexec/nfsrahead from rpm nfs-utils-2.8.6-0.fc43.x86_64 Module libpcre2-8.so.0 from rpm pcre2-10.47-1.fc43.x86_64 Module libselinux.so.1 from rpm libselinux-3.9-5.fc43.x86_64 Module libblkid.so.1 from rpm util-linux-2.41.3-7.fc43.x86_64 Module libmount.so.1 from rpm util-linux-2.41.3-7.fc43.x86_64 Stack trace of thread 869:

 #0  0x00007f1a867653cc __pthread_kill_implementation (libc.so.6 + 0x743cc)
 #1  0x00007f1a8670b15e raise (libc.so.6 + 0x1a15e)
 #2  0x00007f1a866f26d0 abort (libc.so.6 + 0x16d0)
 #3  0x00007f1a866f373b __libc_message_impl.cold (libc.so.6 + 0x273b)
 #4  0x00007f1a8676f665 malloc_printerr (libc.so.6 + 0x7e665)
 #5  0x00007f1a8676f684 malloc_printerr_tail (libc.so.6 + 0x7e684)
 #6  0x00005624543b1d32 main (/usr/libexec/nfsrahead + 0xd32)
 #7  0x00007f1a866f45b5 __libc_start_call_main (libc.so.6 + 0x35b5)
 #8  0x00007f1a866f4668 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x3668)
 #9  0x00005624543b1fb5 _start (/usr/libexec/nfsrahead + 0xfb5)

ELF object binary architecture: AMD x86-64

https://bodhi.fedoraproject.org/updates/FEDORA-2026-e033b6bafe

This reverts commit 0f5fe65d83f7455112aea82bf96f99523cb03ca7.

---
 tools/nfsrahead/main.c | 55 +-----------------------------------------
 1 file changed, 1 insertion(+), 54 deletions(-)
tools/nfsrahead/main.c +1 -54
index 78cd2581..b7b889ff 100644
@@ -3,7 +3,6 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <unistd.h>
-#include <time.h>
 
 #include <libmount/libmount.h>
 #include <sys/sysmacros.h>
@@ -18,8 +17,6 @@
 #define CONF_NAME "nfsrahead"
 #define NFS_DEFAULT_READAHEAD 128
 
-#define MNT_NM_TIMEOUT 10000
-
 /* Device information from the system */
 struct device_info {
 	char *device_number;
@@ -120,57 +117,7 @@ out_free_device_info:
 
 static int get_device_info(const char *device_number, struct device_info *device_info)
 {
-	int ret;
-	struct libmnt_monitor *mn = NULL;
-	struct timespec start, now;
-	int remaining_ms = MNT_NM_TIMEOUT;
-
-	/*
-	 * Fast-path rejection:
-	 * NFS backing devices always use the anonymous block device major number (0).
-	 * If the device number does not start with "0:", it is a physical block device
-	 * and will never be an NFS mount. Exit immediately to prevent blocking udev.
-	 */
-	if (strncmp(device_number, "0:", 2) != 0)
-		return -ENODEV;
-
-	ret = get_mountinfo(device_number, device_info, MOUNTINFO_PATH);
-	if (ret == 0)
-		return 0;
-
-	mn = mnt_new_monitor();
-	if (!mn)
-		goto fallback;
-
-	if (mnt_monitor_enable_kernel(mn, 1) < 0) {
-		mnt_unref_monitor(mn);
-		goto fallback;
-	}
-
-	clock_gettime(CLOCK_MONOTONIC, &start);
-
-	while (remaining_ms > 0) {
-		int rc = mnt_monitor_wait(mn, remaining_ms);
-		if (rc > 0) {
-			ret = get_mountinfo(device_number, device_info, MOUNTINFO_PATH);
-			if (ret == 0) {
-				mnt_unref_monitor(mn);
-				return 0;
-			}
-		} else {
-			break;
-		}
-
-		clock_gettime(CLOCK_MONOTONIC, &now);
-		long elapsed_ms = (now.tv_sec - start.tv_sec) * 1000 +
-				  (now.tv_nsec - start.tv_nsec) / 1000000;
-		remaining_ms = MNT_NM_TIMEOUT - elapsed_ms;
-	}
-
-	mnt_unref_monitor(mn);
-	return ret;
-
-fallback:
+	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);
Signature · 1 line
2.53.0
#1 lore raw
Quoted 10 lines · Steve Dickson
 #1  0x00007f1a8670b15e raise (libc.so.6 + 0x1a15e)
 #2  0x00007f1a866f26d0 abort (libc.so.6 + 0x16d0)
 #3  0x00007f1a866f373b __libc_message_impl.cold (libc.so.6 + 0x273b)
 #4  0x00007f1a8676f665 malloc_printerr (libc.so.6 + 0x7e665)
 #5  0x00007f1a8676f684 malloc_printerr_tail (libc.so.6 + 0x7e684)
 #6  0x00005624543b1d32 main (/usr/libexec/nfsrahead + 0xd32)
 #7  0x00007f1a866f45b5 __libc_start_call_main (libc.so.6 + 0x35b5)
 #8  0x00007f1a866f4668 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x3668)
 #9  0x00005624543b1fb5 _start (/usr/libexec/nfsrahead + 0xfb5)

ELF object binary architecture: AMD x86-64

Hi Steve,

Quoted 4 lines

https://bodhi.fedoraproject.org/updates/FEDORA-2026-e033b6bafe

This reverts commit 0f5fe65d83f7455112aea82bf96f99523cb03ca7.
---

I thought this was resolved with [PATCH 1/2] nfsrahead: zero-initialise device_info struct [1], no?

[1]: https://lore.kernel.org/linux-nfs/[email protected]/T/#t

Please note that series [2] is based on this particular patch.

[2]: https://lore.kernel.org/linux-nfs/[email protected]/T/#m1309a5bf24457934f3d2db7ca5706e240aae51d1

Kind regards,

Signature · 1 line
Aaron Tomlin
#2 lore raw
Quoted 23 lines · Aaron Tomlin
Quoted 10 lines · Steve Dickson
  #1  0x00007f1a8670b15e raise (libc.so.6 + 0x1a15e)
  #2  0x00007f1a866f26d0 abort (libc.so.6 + 0x16d0)
  #3  0x00007f1a866f373b __libc_message_impl.cold (libc.so.6 + 0x273b)
  #4  0x00007f1a8676f665 malloc_printerr (libc.so.6 + 0x7e665)
  #5  0x00007f1a8676f684 malloc_printerr_tail (libc.so.6 + 0x7e684)
  #6  0x00005624543b1d32 main (/usr/libexec/nfsrahead + 0xd32)
  #7  0x00007f1a866f45b5 __libc_start_call_main (libc.so.6 + 0x35b5)
  #8  0x00007f1a866f4668 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x3668)
  #9  0x00005624543b1fb5 _start (/usr/libexec/nfsrahead + 0xfb5)

ELF object binary architecture: AMD x86-64

Hi Steve,

Quoted 4 lines

https://bodhi.fedoraproject.org/updates/FEDORA-2026-e033b6bafe

This reverts commit 0f5fe65d83f7455112aea82bf96f99523cb03ca7.
---

I thought this was resolved with [PATCH 1/2] nfsrahead: zero-initialise device_info struct [1], no?

[1]: https://lore.kernel.org/linux-nfs/[email protected]/T/#t

Quoted 7 lines

Please note that series [2] is based on this particular patch.

[2]: https://lore.kernel.org/linux-nfs/[email protected]/T/#m1309a5bf24457934f3d2db7ca5706e240aae51d1

Kind regards,

Okay... v2 does apply so I'll go with those....

steved.