[LTP] [PATCH] fanotify: Fix broken tests due to fanotify_events_supported_by_kernel()

Jan Kara jack@suse.cz
Mon Nov 27 19:26:02 CET 2023


On Mon 27-11-23 19:40:14, Amir Goldstein wrote:
> On Mon, Nov 27, 2023 at 5:40 PM Jan Kara <jack@suse.cz> wrote:
> >
> > 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.
> >
> 
> FWIW, "." in setup() is usually a tempdir (under LTP temp root)
> So I'm not sure that "/" is a better choice than ".".
> At least the LTP temp dir is configurable.
> and no reason that "/" is not a btrfs subvol inside a container...

Yeah, that's a good point. I was thinking it need not be so simple but
wanted something to start a discussion :)

> FYI, in this branch:
> https://github.com/amir73il/ltp/commits/fanotify_fsid
> 
> I have already implemented fanotify_flags_supported_on_fs()
> which can be used to test support for an event/mark on a specific path.
> 
> I did not make the change in fanotify16.c to use
> fanotify_flags_supported_on_fs() instead of
> fanotify_{mark,events}_supported_by_kernel() but it would be trivial to do.

OK, this is probably a more robust idea so that we test all the features
against a path we are then actually going to use for testing. I'll pick the
commit "fanotify: Generalize helper fanotify_flags_supported_on_fs()" from
your branch and rework the fix based on that tomorrow. Thanks!

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR


More information about the ltp mailing list