Re: [PATCH] fstests Fix build errors on kernels before v5.1
Andrey Albershteyn <[email protected]> Thu, 23 Jul 2026 10:26:51 +0200
| Newsgroups | org.kernel.vger.fstests |
|---|---|
| Message-ID | <[email protected]> |
On 2026-07-23 15:27:13, Donald Douwsma wrote:
> On 23/7/26 03:49, Lukas Herbolt wrote:
> > On 2026-07-22 11:35, Andrey Albershteyn wrote:
> >> On 2026-07-22 07:22:58, Lukas Herbolt wrote:
> >>> The FAN_REPORT_FID and fanotify_event_info_fid were introduced
> >>> in v5.1. Currently there is no check if the kernel supports it
> >>> making xfstests build to fail on older kernels.
> >>>
> >>> Fixes: 29d120e41c3d ("generic: test fsnotify filesystem error reporting")
> >>>
> >>> Signed-off-by: Lukas Herbolt <[email protected]>
> >>
> >> Looks good to me
> >> Reviewed-by: Andrey Albershteyn <[email protected]>
> >>
> >>> ---
> >>>  configure.ac         | 1 +
> >>>  include/builddefs.in | 1 +
> >>> Â m4/package_libcdev.m4 | 14 ++++++++++++++
> >>>  src/Makefile         | 6 +++++-
> >>> Â 4 files changed, 21 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/configure.ac b/configure.ac
> >>> index 441f543c6089..feb24ddd8854 100644
> >>> --- a/configure.ac
> >>> +++ b/configure.ac
> >>> @@ -74,6 +74,7 @@ AC_NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE
> >>> Â AC_HAVE_FICLONE
> >>> Â AC_HAVE_TRIVIAL_AUTO_VAR_INIT
> >>> Â AC_HAVE_FILE_GETATTR
> >>> +AC_HAVE_FANOTIFY_FID
> >>>
> >>> Â AC_CHECK_FUNCS([renameat2])
> >>> Â AC_CHECK_FUNCS([reallocarray])
> >>> diff --git a/include/builddefs.in b/include/builddefs.in
> >>> index 708d75b24d76..8e9e2e3b4113 100644
> >>> --- a/include/builddefs.in
> >>> +++ b/include/builddefs.in
> >>> @@ -75,6 +75,7 @@ HAVE_RLIMIT_NOFILE = @have_rlimit_nofile@
> >>> Â NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE = @need_internal_xfs_ioc_exchange_range@
> >>> Â HAVE_FICLONE = @have_ficlone@
> >>> Â HAVE_FILE_GETATTR = @have_file_getattr@
> >>> +HAVE_FANOTIFY_FID = @have_fanotify_fid@
> >>>
> >>> Â GCCFLAGS = -std=gnu11 -funsigned-char -fno-strict-aliasing -Wall
> >>> Â SANITIZER_CFLAGS += @autovar_init_cflags@
> >>> diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4
> >>> index 17f57f427410..340cdad3faf9 100644
> >>> --- a/m4/package_libcdev.m4
> >>> +++ b/m4/package_libcdev.m4
> >>> @@ -102,3 +102,17 @@ AC_DEFUN([AC_HAVE_FILE_GETATTR],
> >>> Â Â Â Â Â Â Â AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
> >>> Â Â Â Â AC_SUBST(have_file_getattr)
> >>> Â Â ])
> >>> +
> >>> +# Check if we have fanotify FID support (Linux 5.1+)
> >>> +AC_DEFUN([AC_HAVE_FANOTIFY_FID],
> >>> +Â [ AC_MSG_CHECKING([for fanotify FID support])
> >>> +Â Â Â AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> >>> +#include <sys/fanotify.h>
> >>> +Â Â Â ]], [[
> >>> +Â Â Â Â Â Â int x = FAN_REPORT_FID;
> >>> +Â Â Â Â Â Â struct fanotify_event_info_fid fid;
> >>> +Â Â Â Â Â Â (void)x; (void)fid;
> >>> +Â Â Â ]])],[have_fanotify_fid=yes
> >>> +Â Â Â Â Â Â AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
> >>> +Â Â Â AC_SUBST(have_fanotify_fid)
> >>> +Â ])
> >>> diff --git a/src/Makefile b/src/Makefile
> >>> index 31ac43b215e9..847fb168181e 100644
> >>> --- a/src/Makefile
> >>> +++ b/src/Makefile
> >>> @@ -36,7 +36,7 @@ LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
> >>> Â Â Â Â fscrypt-crypt-util bulkstat_null_ocount splice-test chprojid_fail \
> >>> Â Â Â Â detached_mounts_propagation ext4_resize t_readdir_3 splice2pipe \
> >>> Â Â Â Â uuid_ioctl t_snapshot_deleted_subvolume fiemap-fault min_dio_alignment \
> >>> -Â Â Â rw_hint fs-monitor
> >>> +Â Â Â rw_hint
> >>>
> >>> Â EXTRA_EXECS = dmerror fill2attr fill2fs fill2fs_check scaleread.sh \
> >>> Â Â Â Â Â Â Â Â Â Â btrfs_crc32c_forged_name.py popdir.pl popattr.py \
> >>> @@ -107,6 +107,10 @@ ifeq ($(HAVE_FICLONE),yes)
> >>> Â Â Â Â Â TARGETS += t_reflink_read_race
> >>> Â endif
> >>>
> >>> +ifeq ($(HAVE_FANOTIFY_FID),yes)
> >>> +Â Â Â Â TARGETS += fs-monitor
> >> ...
> >>> Â Â Â Â Â LINUX_TARGETS += t_btrfs_received_uuid_ioctl
> >>
> >> hah just noticed that fstests "supports" different targets (darwin,
> >> freebsd), not sure if it works at all
> >
> > Ugh! Indeed that should be LINUX_TARGETS += fs-monitor
> > I will send v2
>
> I think this was mainly to allow for IRIX back when fstests ran there, the
> last of which were removed by
>
> bc2568f9 fstests: remove IRIX test program open_unlink
>
> A lot of the more recent programs in TARGETS look like they wouldn't apply
> to anything outside of linux, i.e. t_ext4_dax_journal_corruption and
> t_ext4_dax_inline_corruption.
>
> Given the use of configure to decide what to compile in it may be clearer
> if this was just simplified to use TARGETS in the long term.
Yeah, it just need a cleanup
--
- Andrey