[LTP] [PATCH] fanotify: Fix broken tests due to fanotify_events_supported_by_kernel()
Jan Kara
jack@suse.cz
Mon Nov 27 16:40:13 CET 2023
When LTP test is run with CWD in btrfs subvolume, tests like fanotify16
fail with:
fanotify.h:169: TBROK: fanotify_mark (3, FAN_MARK_ADD, ..., AT_FDCWD, ".") failed: EXDEV (18)
This is because fanotify_events_supported_by_kernel() try to place a
mark onto CWD and that is forbidden for btrfs subvolumes. Change
fanotify_events_supported_by_kernel() to use "/" instead of "." which
has higher chances of working for btrfs.
Also update the error message to provide a bit more info.
Signed-off-by: Jan Kara <jack@suse.cz>
---
testcases/kernel/syscalls/fanotify/fanotify.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
index 32b510cdc178..f2fe0c05b449 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify.h
+++ b/testcases/kernel/syscalls/fanotify/fanotify.h
@@ -161,12 +161,13 @@ static inline int fanotify_events_supported_by_kernel(uint64_t mask,
fd = SAFE_FANOTIFY_INIT(init_flags, O_RDONLY);
- if (fanotify_mark(fd, FAN_MARK_ADD | mark_flags, mask, AT_FDCWD, ".") < 0) {
+ if (fanotify_mark(fd, FAN_MARK_ADD | mark_flags, mask, AT_FDCWD, "/") < 0) {
if (errno == EINVAL) {
rval = -1;
} else {
tst_brk(TBROK | TERRNO,
- "fanotify_mark (%d, FAN_MARK_ADD, ..., AT_FDCWD, \".\") failed", fd);
+ "fanotify_mark (%d, FAN_MARK_ADD | %x, %llx, AT_FDCWD, \".\") failed",
+ fd, mark_flags, (unsigned long long)mask);
}
}
--
2.35.3
More information about the ltp
mailing list