[LTP] LTP/fanotify01 corner case

Murphy Zhou jencce.kernel@gmail.com
Tue May 14 09:21:10 CEST 2024


Hi Amir,

When TMPDIR is on NFS, fanotify01 get ENODEV when testing if it supports
reporting events with fid from multi fs in setup():

        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");
>         }
>

later in test_fanotify(), fd_notify firstly gets added a mark for the fs
mounted within the NFS TMPDIR,

and then at the end of test_fanotify(), added another mark for the TMPDIR
which is NFS in this case, and check on the errno:

        ret = report_fid ? inode_mark_fid_xdev : 0;
>
>         TST_EXP_FD_OR_FAIL(fanotify_mark(fd_notify, FAN_MARK_ADD,
> FAN_CLOSE_WRITE,
>                                          AT_FDCWD, "."), ret);
>


It worked fine till

commit 30ad1938326bf9303ca38090339d948975a626f5
> Author: Amir Goldstein <amir73il@gmail.com>
> Date:   Thu Nov 30 18:56:19 2023 +0200
>
>     fanotify: allow "weak" fsid when watching a single filesystem
>

After this commit was merged, the first check got ENODEV and the second
check got EXDEV.

The both values make sense in their situation, but it seems like using one
value as expected value for another seems not accurate here for me. I don't
know much here, your help is much appreciated.

Thanks,
Murphy

A simple reproducer attached for handy.

>
> #! /bin/bash
>
> mnt=/lmnt
> nfs_tst_export=/export/nfstest
> mkdir -p $nfs_tst_export $mnt
>
> cp -f /etc/exports{,bak}
> echo $nfs_tst_export \*\(rw,no_root_squash\) > /etc/exports
> systemctl restart nfs-server
> exportfs
>
> umount $mnt > /dev/null 2>&1
> MOUNT_OPTIONS="-o vers=4.2 "
> mount $MOUNT_OPTIONS localhost:$nfs_tst_export $mnt || exit
> mount | grep nfs
>
> TMPDIR=$mnt LTP_SINGLE_FS_TYPE=xfs
> ./ltp/testcases/kernel/syscalls/fanotify/fanotify01
>
> umount $mnt
> cp -f /etc/exports{bak,}
> systemctl restart nfs-server
>


More information about the ltp mailing list