[LTP] LTP/fanotify01 corner case
Murphy Zhou
jencce.kernel@gmail.com
Tue May 21 03:02:48 CEST 2024
On Wed, May 15, 2024 at 2:37 AM Amir Goldstein <amir73il@gmail.com> wrote:
> On Tue, May 14, 2024 at 1:21 AM Murphy Zhou <jencce.kernel@gmail.com>
> wrote:
> >
> > 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.
>
> Your analysis is exact and correct.
>
> The commit above caused a behavior change in that case moving from one
> error that makes sense to another error that makes sense and the test
> should cope with that.
>
> The easiest would be to open code TST_EXP_FD_OR_FAIL()
> helper and check for either
> errno == inode_mark_fid_xdev || errno == EXDEV.
> not sure if there is an LTP helper for this pattern.
>
Thanks for the confirmation and suggestion!
> Thanks,
> Amir.
>
More information about the ltp
mailing list