[LTP] [PATCH] fanotify01: Test setting two marks on different filesystems
Amir Goldstein
amir73il@gmail.com
Tue Jan 30 15:58:28 CET 2024
On Tue, Jan 30, 2024 at 3:07 PM Petr Vorel <pvorel@suse.cz> wrote:
>
> Hi Amir, Jan,
>
> I was going to merge, but I suspect this does not work on TMPDIR on btrfs.
>
This is a problem because the test result depends on the type of TMPDIR.
The failure in your case is because TMPDIR is not only btrfs, but a
btrfs subvol.
Jan has dealt with several related fanotify tests failures lately.
> Tested on SLE 15-SP6 (kernel 6.4), on 15-SP4 (kernel 5.14), Tumbleweed (kernel
> 6.8.0-rc1), Alpine Linux (kernel 6.4) I get:
>
> fanotify01.c:341: TFAIL: fanotify_mark(fd_notify, 0x00000001, 0x00000008, -100, ".") failed: EXDEV (18)
>
> for tests #3, #4 and #5 on all filesystems.
>
> Testing on other on other filesystem it works: Debian kernel 5.10, 6.1 on ext4,
> Alpine Linux kernel 6.4 on tmpfs, Tumbleweed kernel 6.8.0-rc1 on tmpfs.
>
> Should be btrfs handled differently or skipped? (below)
> Or test EXDEV for #3, #4 and #5? (not sure how handle just half of the tests on
> btrfs differently).
>
> Kind regards,
> Petr
>
> diff --git testcases/kernel/syscalls/fanotify/fanotify01.c testcases/kernel/syscalls/fanotify/fanotify01.c
> index ba09f309d..97ade1829 100644
> --- testcases/kernel/syscalls/fanotify/fanotify01.c
> +++ testcases/kernel/syscalls/fanotify/fanotify01.c
> @@ -335,8 +335,15 @@ pass:
> * different filesystems are supported.
> * When tested fs has zero fsid (e.g. fuse) and events are reported
> * with fsid+fid, watching different filesystems is not supported.
> + * Not supported on Btrfs.
> */
> + if (tst_fs_type(".") == TST_BTRFS_MAGIC) {
> + tst_res(TCONF, "skipped on Btrfs");
> + return;
> + }
> +
Note that btrfs is not the FS under test. It is the FS of TMPFS,
so even if you did skip, this message would have been wrong.
Please try the patch below.
Thanks,
Amir.
--- a/testcases/kernel/syscalls/fanotify/fanotify01.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify01.c
@@ -364,12 +364,19 @@ static void setup(void)
mount_mark_fid_unsupported =
fanotify_flags_supported_on_fs(FAN_REPORT_FID,
FAN_MARK_MOUNT,
FAN_OPEN, fname);
- /* When mount mark is not supported due to zero fsid, multi fs
inode marks are not supported */
+ /*
+ * When mount mark is not supported due to zero fsid (e.g.
fuse) or if TMPDIR has non-uniform
+ * fsid (e.g. btrfs subvol), multi fs inode marks are not supported.
+ */
if (mount_mark_fid_unsupported && errno == ENODEV) {
tst_res(TINFO, "filesystem %s does not support
reporting events with fid from multi fs",
tst_device->fs_type);
inode_mark_fid_xdev = EXDEV;
}
+ 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");
+ }
}
More information about the ltp
mailing list