Skip to contentSkip to conversation

fanotify01: fix test failure when running with nfs TMPDIR

PATCH In review Amir Goldstein 2 participants 2 messages Feb 15, 2025 – Feb 17, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fanotify01: fix test failure when running with nfs TMPDIR

If TMPDIR does not support mount watches due to ENODEV, the failure to watch multiple fs would be EXDEV and not ENODEV.

---
 testcases/kernel/syscalls/fanotify/fanotify01.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/fanotify/fanotify01.c +3 -2
index c7e759166..38f5a0791 100644
@@ -375,8 +375,9 @@ static void setup(void)
 	}
 
 	if (fanotify_flags_supported_on_fs(FAN_REPORT_FID, FAN_MARK_MOUNT, FAN_OPEN, ".")) {
-		inode_mark_fid_xdev = errno;
-		tst_res(TINFO, "TMPDIR does not support reporting events with fid from multi fs");
+		inode_mark_fid_xdev = (errno == ENODEV) ? EXDEV : errno;
+		tst_res(TINFO, "TMPDIR does not support reporting events with fid from multi fs"
+				" (errno = %d)", errno);
 	}
 }
 
Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Amir,

Quoted 14 lines

If TMPDIR does not support mount watches due to ENODEV, the failure to watch multiple fs would be EXDEV and not ENODEV.

---
 testcases/kernel/syscalls/fanotify/fanotify01.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
testcases/kernel/syscalls/fanotify/fanotify01.c +0 -0
index c7e759166..38f5a0791 100644

testcases/kernel/syscalls/fanotify/fanotify01.c static void setup(void) · line 380

Quoted 8 lines
testcases/kernel/syscalls/fanotify/fanotify01.c +3 -2
@@ -375,8 +375,9 @@ static void setup(void)
 	}
 
 	if (fanotify_flags_supported_on_fs(FAN_REPORT_FID, FAN_MARK_MOUNT, FAN_OPEN, ".")) {
-		inode_mark_fid_xdev = errno;
-		tst_res(TINFO, "TMPDIR does not support reporting events with fid from multi fs");
+		inode_mark_fid_xdev = (errno == ENODEV) ? EXDEV : errno;
+		tst_res(TINFO, "TMPDIR does not support reporting events with fid from multi fs"
+				" (errno = %d)", errno);

I merged with LTP specific flag TERRNO which prints both string and numeric value for errno:

		tst_res(TINFO | TERRNO, "TMPDIR does not support reporting events with fid from multi fs");

Thanks for a fix!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp