Skip to contentSkip to conversation

fstests Fix build errors on kernels before v5.1

PATCH In review Lukas Herbolt 4 participants 9 messages Jul 22 – Jul 29

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fstests Fix build errors on kernels before v5.1

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")
---
 configure.ac          |  1 +
 include/builddefs.in  |  1 +
 m4/package_libcdev.m4 | 14 ++++++++++++++
 src/Makefile          |  6 +++++-
 4 files changed, 21 insertions(+), 1 deletion(-)
configure.ac +1 -0
index 441f543c6089..feb24ddd8854 100644
@@ -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])
include/builddefs.in +1 -0
index 708d75b24d76..8e9e2e3b4113 100644
@@ -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@
m4/package_libcdev.m4 +14 -0
index 17f57f427410..340cdad3faf9 100644
@@ -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)
+  ])
src/Makefile +5 -1
index 31ac43b215e9..847fb168181e 100644
@@ -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
+endif
+
 ifeq ($(HAVE_LIBBTRFSUTIL), true)
      LINUX_TARGETS += t_btrfs_received_uuid_ioctl
 endif

base-commit: acb6d4cb84205a8e3f19ca470cfcf7bf6d93a509

Signature · 1 line
2.55.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Lukas Herbolt

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

Looks good to me

Quoted 72 lines
---
 configure.ac          |  1 +
 include/builddefs.in  |  1 +
 m4/package_libcdev.m4 | 14 ++++++++++++++
 src/Makefile          |  6 +++++-
 4 files changed, 21 insertions(+), 1 deletion(-)
configure.ac +1 -0
index 441f543c6089..feb24ddd8854 100644
@@ -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])
include/builddefs.in +1 -0
index 708d75b24d76..8e9e2e3b4113 100644
@@ -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@
m4/package_libcdev.m4 +14 -0
index 17f57f427410..340cdad3faf9 100644
@@ -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)
+  ])
src/Makefile +3 -1
index 31ac43b215e9..847fb168181e 100644
@@ -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

...

Quoted 1 line
      LINUX_TARGETS += t_btrfs_received_uuid_ioctl

hah just noticed that fstests "supports" different targets (darwin, freebsd), not sure if it works at all

Signature · 1 line
- Andrey
#2 lore raw
Quoted 85 lines · Andrey Albershteyn
Quoted 7 lines · Lukas Herbolt

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

Looks good to me

Quoted 73 lines
---
 configure.ac          |  1 +
 include/builddefs.in  |  1 +
 m4/package_libcdev.m4 | 14 ++++++++++++++
 src/Makefile          |  6 +++++-
 4 files changed, 21 insertions(+), 1 deletion(-)
configure.ac +1 -0
index 441f543c6089..feb24ddd8854 100644
@@ -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])
include/builddefs.in +0 -0
index 708d75b24d76..8e9e2e3b4113 100644
@@ -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@

include/builddefs.in +1 -0
+HAVE_FANOTIFY_FID = @have_fanotify_fid@
 
 GCCFLAGS = -std=gnu11 -funsigned-char -fno-strict-aliasing -Wall
 SANITIZER_CFLAGS += @autovar_init_cflags@
m4/package_libcdev.m4 +14 -0
index 17f57f427410..340cdad3faf9 100644
@@ -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)
+  ])
src/Makefile +1 -1
index 31ac43b215e9..847fb168181e 100644
@@ -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 \

src/Makefile +0 -0
 	      btrfs_crc32c_forged_name.py popdir.pl popattr.py \
@@ -107,6 +107,10 @@ ifeq ($(HAVE_FICLONE),yes)
      TARGETS += t_reflink_read_race
 endif
 
Quoted 7 lines
Quoted 2 lines
src/Makefile +2 -0
+ifeq ($(HAVE_FANOTIFY_FID),yes)
+     TARGETS += fs-monitor

...

Quoted 1 line
      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

Signature · 1 line
-lhe
#3 lore raw
Quoted 86 lines · Lukas Herbolt
Quoted 85 lines · Andrey Albershteyn
Quoted 7 lines · Lukas Herbolt

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

Looks good to me

Quoted 72 lines

---
 configure.ac          |  1 +
 include/builddefs.in  |  1 +
 m4/package_libcdev.m4 | 14 ++++++++++++++
 src/Makefile          |  6 +++++-

 4 files changed, 21 insertions(+), 1 deletion(-)
configure.ac +0 -0
index 441f543c6089..feb24ddd8854 100644
@@ -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])

include/builddefs.in +0 -0
index 708d75b24d76..8e9e2e3b4113 100644
@@ -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@

m4/package_libcdev.m4 +14 -0
index 17f57f427410..340cdad3faf9 100644
@@ -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)
+  ])
src/Makefile +1 -1
index 31ac43b215e9..847fb168181e 100644
@@ -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

...

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

      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.

#4 lore raw
Quoted 98 lines · Donald Douwsma
Quoted 86 lines · Lukas Herbolt
Quoted 85 lines · Andrey Albershteyn
Quoted 7 lines · Lukas Herbolt

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

Looks good to me

Quoted 72 lines

---
 configure.ac          |  1 +
 include/builddefs.in  |  1 +
 m4/package_libcdev.m4 | 14 ++++++++++++++
 src/Makefile          |  6 +++++-

 4 files changed, 21 insertions(+), 1 deletion(-)
configure.ac +0 -0
index 441f543c6089..feb24ddd8854 100644
@@ -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])

include/builddefs.in +0 -0
index 708d75b24d76..8e9e2e3b4113 100644
@@ -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@

m4/package_libcdev.m4 +14 -0
index 17f57f427410..340cdad3faf9 100644
@@ -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)
+  ])
src/Makefile +1 -1
index 31ac43b215e9..847fb168181e 100644
@@ -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

...

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

      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

Quoted 8 lines

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

Signature · 1 line
- Andrey
#5 lore raw
Quoted 101 lines · Andrey Albershteyn
Quoted 100 lines · Donald Douwsma
Quoted 86 lines · Lukas Herbolt
Quoted 85 lines · Andrey Albershteyn
Quoted 7 lines · Lukas Herbolt

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

Looks good to me

Quoted 72 lines

---
 configure.ac          |  1 +
 include/builddefs.in  |  1 +
 m4/package_libcdev.m4 | 14 ++++++++++++++
 src/Makefile          |  6 +++++-

 4 files changed, 21 insertions(+), 1 deletion(-)
configure.ac +0 -0
index 441f543c6089..feb24ddd8854 100644
@@ -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])

include/builddefs.in +0 -0
index 708d75b24d76..8e9e2e3b4113 100644
@@ -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@

m4/package_libcdev.m4 +14 -0
index 17f57f427410..340cdad3faf9 100644
@@ -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)
+  ])
src/Makefile +1 -1
index 31ac43b215e9..847fb168181e 100644
@@ -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

...

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

      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

Quoted 8 lines
Quoted 6 lines

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

Ok, let's just stick with this version and I will try too look into unifying of the targets.

Signature · 1 line
-lhe
#6 lore raw
In reply to Andrey Albershteyn
Quoted 82 lines · Andrey Albershteyn
Quoted 7 lines · Lukas Herbolt

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

Looks good to me

Quoted 70 lines
---
 configure.ac          |  1 +
 include/builddefs.in  |  1 +
 m4/package_libcdev.m4 | 14 ++++++++++++++
 src/Makefile          |  6 +++++-
 4 files changed, 21 insertions(+), 1 deletion(-)
configure.ac +1 -0
index 441f543c6089..feb24ddd8854 100644
@@ -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])
include/builddefs.in +1 -0
index 708d75b24d76..8e9e2e3b4113 100644
@@ -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@
m4/package_libcdev.m4 +14 -0
index 17f57f427410..340cdad3faf9 100644
@@ -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)
+  ])
src/Makefile +1 -1
index 31ac43b215e9..847fb168181e 100644
@@ -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
 
Quoted 7 lines
Quoted 2 lines
src/Makefile +2 -0
+ifeq ($(HAVE_FANOTIFY_FID),yes)
+     TARGETS += fs-monitor

...

Quoted 1 line
      LINUX_TARGETS += t_btrfs_received_uuid_ioctl

hah just noticed that fstests "supports" different targets (darwin, freebsd), not sure if it works at all

As far as I know, fstests is currently a Linux filesystem testing suite. I don't recall us ever being asked to support FreeBSD or other operating systems, though I'm not sure if anyone is actually using it that way :)

Quoted 4 lines
Signature · 2 lines
-- 
- Andrey
#7 lore raw
Quoted 86 lines · Zorro Lang
Quoted 85 lines · Andrey Albershteyn
Quoted 7 lines · Lukas Herbolt

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

Looks good to me

Quoted 72 lines
---
 configure.ac          |  1 +
 include/builddefs.in  |  1 +
 m4/package_libcdev.m4 | 14 ++++++++++++++
 src/Makefile          |  6 +++++-
 4 files changed, 21 insertions(+), 1 deletion(-)
configure.ac +1 -0
index 441f543c6089..feb24ddd8854 100644
@@ -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])
include/builddefs.in +1 -0
index 708d75b24d76..8e9e2e3b4113 100644
@@ -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@
m4/package_libcdev.m4 +14 -0
index 17f57f427410..340cdad3faf9 100644
@@ -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)
+  ])
src/Makefile +3 -1
index 31ac43b215e9..847fb168181e 100644
@@ -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

...

Quoted 9 lines
Quoted 4 lines
Quoted 1 line
      LINUX_TARGETS += t_btrfs_received_uuid_ioctl

hah just noticed that fstests "supports" different targets (darwin, freebsd), not sure if it works at all

As far as I know, fstests is currently a Linux filesystem testing suite. I don't recall us ever being asked to support FreeBSD or other operating systems, though I'm not sure if anyone is actually using it that way :)

Then, I would suggest to move everthing under LINUX_TARGETS to keep it clean. If there will be new platform in the future, we can separate it again into TARGETS and ${PLATFORM}_TARGETS

Signature · 1 line
-lhe
Reviewed-by on v1 1/1
#8 lore raw
In reply to Lukas Herbolt
Quoted 7 lines · Lukas Herbolt

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

Looks good!

Quoted 79 lines
---
 configure.ac          |  1 +
 include/builddefs.in  |  1 +
 m4/package_libcdev.m4 | 14 ++++++++++++++
 src/Makefile          |  6 +++++-
 4 files changed, 21 insertions(+), 1 deletion(-)
configure.ac +1 -0
index 441f543c6089..feb24ddd8854 100644
@@ -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])
include/builddefs.in +1 -0
index 708d75b24d76..8e9e2e3b4113 100644
@@ -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@
m4/package_libcdev.m4 +14 -0
index 17f57f427410..340cdad3faf9 100644
@@ -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)
+  ])
src/Makefile +5 -1
index 31ac43b215e9..847fb168181e 100644
@@ -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
+endif
+
 ifeq ($(HAVE_LIBBTRFSUTIL), true)
      LINUX_TARGETS += t_btrfs_received_uuid_ioctl
 endif

base-commit: acb6d4cb84205a8e3f19ca470cfcf7bf6d93a509