selftests/fs/mount-notify: Fix compilation failure.
PATCH 1/1 selftests/fs/mount-notify: Fix compilation failure.
Commit c6d9775c2066 ("selftests/fs/mount-notify: build with tools include dir") introduces the struct __kernel_fsid_t to decouple dependency with headers_install. The commit forgets to define a macro for __kernel_fsid_t and it will cause type re-definition issue.
--- .../mount-notify/mount-notify_test.c | 17 ++++++++--------- .../mount-notify/mount-notify_test_ns.c | 18 ++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-)
tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c +8 -9
@@ -2,6 +2,13 @@// Copyright (c) 2025 Miklos Szeredi <[email protected]> #define _GNU_SOURCE + +// Needed for linux/fanotify.h +typedef struct { +int val[2 ]; +}__kernel_fsid_t ; +#define __kernel_fsid_t __kernel_fsid_t +#include <fcntl.h> #include <sched.h> #include <stdio.h>
@@ -10,20 +17,12 @@#include <sys/mount.h> #include <unistd.h> #include <sys/syscall.h> +#include <sys/fanotify.h> #include "../../kselftest_harness.h" #include "../statmount/statmount.h" #include "../utils.h" -// Needed for linux/fanotify.h -#ifndef __kernel_fsid_t -typedef struct { -int val[2 ]; -}__kernel_fsid_t ; -#endif - -#include <sys/fanotify.h> -static const char root_mntpoint_templ[] ="/tmp/mount-notify_test_root.XXXXXX" ;static const int mark_cmds[] = {
tools/testing/selftests/filesystems/mount-notify/mount-notify_test_ns.c +8 -10
@@ -2,6 +2,13 @@// Copyright (c) 2025 Miklos Szeredi <[email protected]> #define _GNU_SOURCE + +// Needed for linux/fanotify.h +typedef struct { +int val[2 ]; +}__kernel_fsid_t ; +#define __kernel_fsid_t __kernel_fsid_t +#include <fcntl.h> #include <sched.h> #include <stdio.h>
@@ -10,21 +17,12 @@#include <sys/mount.h> #include <unistd.h> #include <sys/syscall.h> +#include <sys/fanotify.h> #include "../../kselftest_harness.h" -#include "../../pidfd/pidfd.h" #include "../statmount/statmount.h" #include "../utils.h" -// Needed for linux/fanotify.h -#ifndef __kernel_fsid_t -typedef struct { -int val[2 ]; -}__kernel_fsid_t ; -#endif - -#include <sys/fanotify.h> -static const char root_mntpoint_templ[] ="/tmp/mount-notify_test_root.XXXXXX" ;static const int mark_types[] = {
Signature · 1 line
2.50.1
Sorry, I forget to attach the error message in my previous email.
CC mount-notify_test_ns
mount-notify_test_ns.c:23:3: error: conflicting types for ‘__kernel_fsid_t’; have ‘struct <anonymous>’
23 | } __kernel_fsid_t;
| ^~~~~~~~~~~~~~~
In file included from /tmp/kselftest/usr/include/asm/posix_types_64.h:18,
from /tmp/kselftest/usr/include/asm/posix_types.h:7,
from /tmp/kselftest/usr/include/linux/posix_types.h:36,
from /tmp/kselftest/usr/include/linux/types.h:9,
from /tmp/kselftest/usr/include/linux/sched/types.h:5,
from /usr/include/bits/sched.h:63,
from /usr/include/sched.h:43,
from mount-notify_test_ns.c:6:
/tmp/kselftest/usr/include/asm-generic/posix_types.h:81:3: note:
previous declaration of ‘__kernel_fsid_t’ with type ‘__kernel_fsid_t’
81 | } __kernel_fsid_t;
| ^~~~~~~~~~~~~~~make[1]: *** [../../lib.mk:222:/tmp/kselftest/kselftest/filesystems/mount-notify/mount-notify_test_ns] Error 1
make[1]: Nothing to be done for 'all'.
Best Regards,
Xing
Quoted 96 lines · Xing Guo
Commit
c6d9775c2066("selftests/fs/mount-notify: build with tools include dir") introduces the struct__kernel_fsid_tto decouple dependency withheaders_install. The commit forgets to define a macro for__kernel_fsid_tand it will cause type re-definition issue.Signed-off-by Xing Guo <[email protected]>--- .../mount-notify/mount-notify_test.c | 17 ++++++++--------- .../mount-notify/mount-notify_test_ns.c | 18 ++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-)tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c +8
-9@@ -2,6 +2,13 @@// Copyright (c) 2025 Miklos Szeredi <[email protected]> #define _GNU_SOURCE + +// Needed for linux/fanotify.h +typedef struct { +int val[2 ]; +}__kernel_fsid_t ; +#define __kernel_fsid_t __kernel_fsid_t +#include <fcntl.h> #include <sched.h> #include <stdio.h> @@ -10,20 +17,12 @@#include <sys/mount.h> #include <unistd.h> #include <sys/syscall.h> +#include <sys/fanotify.h> #include "../../kselftest_harness.h" #include "../statmount/statmount.h" #include "../utils.h" -// Needed for linux/fanotify.h -#ifndef __kernel_fsid_t -typedef struct { -int val[2 ]; -}__kernel_fsid_t ; -#endif - -#include <sys/fanotify.h> -static const char root_mntpoint_templ[] ="/tmp/mount-notify_test_root.XXXXXX" ;static const int mark_cmds[] = {tools/testing/selftests/filesystems/mount-notify/mount-notify_test_ns.c +8
-11@@ -2,6 +2,13 @@// Copyright (c) 2025 Miklos Szeredi <[email protected]> #define _GNU_SOURCE + +// Needed for linux/fanotify.h +typedef struct { +int val[2 ]; +}__kernel_fsid_t ; +#define __kernel_fsid_t __kernel_fsid_t +#include <fcntl.h> #include <sched.h> #include <stdio.h> @@ -10,21 +17,12 @@#include <sys/mount.h> #include <unistd.h> #include <sys/syscall.h> +#include <sys/fanotify.h> #include "../../kselftest_harness.h" -#include "../../pidfd/pidfd.h" #include "../statmount/statmount.h" #include "../utils.h" -// Needed for linux/fanotify.h -#ifndef __kernel_fsid_t -typedef struct { -int val[2 ]; -}__kernel_fsid_t ; -#endif - -#include <sys/fanotify.h> -static const char root_mntpoint_templ[] ="/tmp/mount-notify_test_root.XXXXXX" ;static const int mark_types[] = { --2.50.1
Quoted 7 lines · Xing Guo
Commit
c6d9775c2066("selftests/fs/mount-notify: build with tools include dir") introduces the struct__kernel_fsid_tto decouple dependency withheaders_install. The commit forgets to define a macro for__kernel_fsid_tand it will cause type re-definition issue.Signed-off-by Xing Guo <[email protected]>
Thank you for fixing this!
Quoted 89 lines
--- .../mount-notify/mount-notify_test.c | 17 ++++++++--------- .../mount-notify/mount-notify_test_ns.c | 18 ++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-)tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c +8
-9@@ -2,6 +2,13 @@// Copyright (c) 2025 Miklos Szeredi <[email protected]> #define _GNU_SOURCE + +// Needed for linux/fanotify.h +typedef struct { +int val[2 ]; +}__kernel_fsid_t ; +#define __kernel_fsid_t __kernel_fsid_t +#include <fcntl.h> #include <sched.h> #include <stdio.h> @@ -10,20 +17,12 @@#include <sys/mount.h> #include <unistd.h> #include <sys/syscall.h> +#include <sys/fanotify.h> #include "../../kselftest_harness.h" #include "../statmount/statmount.h" #include "../utils.h" -// Needed for linux/fanotify.h -#ifndef __kernel_fsid_t -typedef struct { -int val[2 ]; -}__kernel_fsid_t ; -#endif - -#include <sys/fanotify.h> -static const char root_mntpoint_templ[] ="/tmp/mount-notify_test_root.XXXXXX" ;static const int mark_cmds[] = {tools/testing/selftests/filesystems/mount-notify/mount-notify_test_ns.c +8
-11@@ -2,6 +2,13 @@// Copyright (c) 2025 Miklos Szeredi <[email protected]> #define _GNU_SOURCE + +// Needed for linux/fanotify.h +typedef struct { +int val[2 ]; +}__kernel_fsid_t ; +#define __kernel_fsid_t __kernel_fsid_t +#include <fcntl.h> #include <sched.h> #include <stdio.h> @@ -10,21 +17,12 @@#include <sys/mount.h> #include <unistd.h> #include <sys/syscall.h> +#include <sys/fanotify.h> #include "../../kselftest_harness.h" -#include "../../pidfd/pidfd.h" #include "../statmount/statmount.h" #include "../utils.h" -// Needed for linux/fanotify.h -#ifndef __kernel_fsid_t -typedef struct { -int val[2 ]; -}__kernel_fsid_t ; -#endif - -#include <sys/fanotify.h> -static const char root_mntpoint_templ[] ="/tmp/mount-notify_test_root.XXXXXX" ;static const int mark_types[] = { --2.50.1
Quoted 8 lines · Amir Goldstein
Quoted 6 lines · Xing Guo
Commit
c6d9775c2066("selftests/fs/mount-notify: build with tools include dir") introduces the struct__kernel_fsid_tto decouple dependency withheaders_install. The commit forgets to define a macro for__kernel_fsid_tand it will cause type re-definition issue.
Quoted 6 lines
Quoted 1 line
Signed-off-by Xing Guo <[email protected]>Thank you for fixing this!
Acked-by Amir Goldstein <[email protected]>
You should probably also add:
Thanks,
Amir,
Quoted 89 lines
Quoted 89 lines
--- .../mount-notify/mount-notify_test.c | 17 ++++++++--------- .../mount-notify/mount-notify_test_ns.c | 18 ++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-)tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c +8
-9@@ -2,6 +2,13 @@// Copyright (c) 2025 Miklos Szeredi <[email protected]> #define _GNU_SOURCE + +// Needed for linux/fanotify.h +typedef struct { +int val[2 ]; +}__kernel_fsid_t ; +#define __kernel_fsid_t __kernel_fsid_t +#include <fcntl.h> #include <sched.h> #include <stdio.h> @@ -10,20 +17,12 @@#include <sys/mount.h> #include <unistd.h> #include <sys/syscall.h> +#include <sys/fanotify.h> #include "../../kselftest_harness.h" #include "../statmount/statmount.h" #include "../utils.h" -// Needed for linux/fanotify.h -#ifndef __kernel_fsid_t -typedef struct { -int val[2 ]; -}__kernel_fsid_t ; -#endif - -#include <sys/fanotify.h> -static const char root_mntpoint_templ[] ="/tmp/mount-notify_test_root.XXXXXX" ;static const int mark_cmds[] = {tools/testing/selftests/filesystems/mount-notify/mount-notify_test_ns.c +8
-11@@ -2,6 +2,13 @@// Copyright (c) 2025 Miklos Szeredi <[email protected]> #define _GNU_SOURCE + +// Needed for linux/fanotify.h +typedef struct { +int val[2 ]; +}__kernel_fsid_t ; +#define __kernel_fsid_t __kernel_fsid_t +#include <fcntl.h> #include <sched.h> #include <stdio.h> @@ -10,21 +17,12 @@#include <sys/mount.h> #include <unistd.h> #include <sys/syscall.h> +#include <sys/fanotify.h> #include "../../kselftest_harness.h" -#include "../../pidfd/pidfd.h" #include "../statmount/statmount.h" #include "../utils.h" -// Needed for linux/fanotify.h -#ifndef __kernel_fsid_t -typedef struct { -int val[2 ]; -}__kernel_fsid_t ; -#endif - -#include <sys/fanotify.h> -static const char root_mntpoint_templ[] ="/tmp/mount-notify_test_root.XXXXXX" ;static const int mark_types[] = { --2.50.1
PATCH 1/1 selftests/fs/mount-notify: Fix compilation failure.
Commit c6d9775c2066 ("selftests/fs/mount-notify: build with tools include dir") introduces the struct __kernel_fsid_t to decouple dependency with headers_install. The commit forgets to define a macro for __kernel_fsid_t and it will cause type re-definition issue.
--- .../mount-notify/mount-notify_test.c | 17 ++++++++--------- .../mount-notify/mount-notify_test_ns.c | 18 ++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-)
tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c +8 -9
@@ -2,6 +2,13 @@// Copyright (c) 2025 Miklos Szeredi <[email protected]> #define _GNU_SOURCE + +// Needed for linux/fanotify.h +typedef struct { +int val[2 ]; +}__kernel_fsid_t ; +#define __kernel_fsid_t __kernel_fsid_t +#include <fcntl.h> #include <sched.h> #include <stdio.h>
@@ -10,20 +17,12 @@#include <sys/mount.h> #include <unistd.h> #include <sys/syscall.h> +#include <sys/fanotify.h> #include "../../kselftest_harness.h" #include "../statmount/statmount.h" #include "../utils.h" -// Needed for linux/fanotify.h -#ifndef __kernel_fsid_t -typedef struct { -int val[2 ]; -}__kernel_fsid_t ; -#endif - -#include <sys/fanotify.h> -static const char root_mntpoint_templ[] ="/tmp/mount-notify_test_root.XXXXXX" ;static const int mark_cmds[] = {
tools/testing/selftests/filesystems/mount-notify/mount-notify_test_ns.c +8 -10
@@ -2,6 +2,13 @@// Copyright (c) 2025 Miklos Szeredi <[email protected]> #define _GNU_SOURCE + +// Needed for linux/fanotify.h +typedef struct { +int val[2 ]; +}__kernel_fsid_t ; +#define __kernel_fsid_t __kernel_fsid_t +#include <fcntl.h> #include <sched.h> #include <stdio.h>
@@ -10,21 +17,12 @@#include <sys/mount.h> #include <unistd.h> #include <sys/syscall.h> +#include <sys/fanotify.h> #include "../../kselftest_harness.h" -#include "../../pidfd/pidfd.h" #include "../statmount/statmount.h" #include "../utils.h" -// Needed for linux/fanotify.h -#ifndef __kernel_fsid_t -typedef struct { -int val[2 ]; -}__kernel_fsid_t ; -#endif - -#include <sys/fanotify.h> -static const char root_mntpoint_templ[] ="/tmp/mount-notify_test_root.XXXXXX" ;static const int mark_types[] = {
Signature · 1 line
2.50.1
Jan Kara
reviewerQuoted 9 lines · Xing Guo
Commit
c6d9775c2066("selftests/fs/mount-notify: build with tools include dir") introduces the struct__kernel_fsid_tto decouple dependency withheaders_install. The commit forgets to define a macro for__kernel_fsid_tand it will cause type re-definition issue.Reported-by kernel test robot <[email protected]>Signed-off-by Xing Guo <[email protected]>Acked-by Amir Goldstein <[email protected]>
Christian, quick search didn't find this patch in your tree. Any reason you didn't pick it up?
Honza
Quoted 89 lines
--- .../mount-notify/mount-notify_test.c | 17 ++++++++--------- .../mount-notify/mount-notify_test_ns.c | 18 ++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-)tools/testing/selftests/filesystems/mount-notify/mount-notify_test.c +8
-9@@ -2,6 +2,13 @@// Copyright (c) 2025 Miklos Szeredi <[email protected]> #define _GNU_SOURCE + +// Needed for linux/fanotify.h +typedef struct { +int val[2 ]; +}__kernel_fsid_t ; +#define __kernel_fsid_t __kernel_fsid_t +#include <fcntl.h> #include <sched.h> #include <stdio.h> @@ -10,20 +17,12 @@#include <sys/mount.h> #include <unistd.h> #include <sys/syscall.h> +#include <sys/fanotify.h> #include "../../kselftest_harness.h" #include "../statmount/statmount.h" #include "../utils.h" -// Needed for linux/fanotify.h -#ifndef __kernel_fsid_t -typedef struct { -int val[2 ]; -}__kernel_fsid_t ; -#endif - -#include <sys/fanotify.h> -static const char root_mntpoint_templ[] ="/tmp/mount-notify_test_root.XXXXXX" ;static const int mark_cmds[] = {tools/testing/selftests/filesystems/mount-notify/mount-notify_test_ns.c +8
-10@@ -2,6 +2,13 @@// Copyright (c) 2025 Miklos Szeredi <[email protected]> #define _GNU_SOURCE + +// Needed for linux/fanotify.h +typedef struct { +int val[2 ]; +}__kernel_fsid_t ; +#define __kernel_fsid_t __kernel_fsid_t +#include <fcntl.h> #include <sched.h> #include <stdio.h> @@ -10,21 +17,12 @@#include <sys/mount.h> #include <unistd.h> #include <sys/syscall.h> +#include <sys/fanotify.h> #include "../../kselftest_harness.h" -#include "../../pidfd/pidfd.h" #include "../statmount/statmount.h" #include "../utils.h" -// Needed for linux/fanotify.h -#ifndef __kernel_fsid_t -typedef struct { -int val[2 ]; -}__kernel_fsid_t ; -#endif - -#include <sys/fanotify.h> -static const char root_mntpoint_templ[] ="/tmp/mount-notify_test_root.XXXXXX" ;static const int mark_types[] = {Signature · 1 line
2.50.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Christian Brauner
maintainerQuoted 6 lines · Jan Kara
Quoted 5 lines · Xing Guo
Commit
c6d9775c2066("selftests/fs/mount-notify: build with tools include dir") introduces the struct__kernel_fsid_tto decouple dependency withheaders_install. The commit forgets to define a macro for__kernel_fsid_tand it will cause type re-definition issue.
Quoted 7 lines
Quoted 4 lines
Reported-by kernel test robot <[email protected]>Signed-off-by Xing Guo <[email protected]>Acked-by Amir Goldstein <[email protected]>Christian, quick search didn't find this patch in your tree. Any reason you didn't pick it up?
Weird. Thanks for the reminder, Jan! Picked into vfs.fixes now!
Quoted 6 lines · Xing Guo
Commit
c6d9775c2066("selftests/fs/mount-notify: build with tools include dir") introduces the struct__kernel_fsid_tto decouple dependency withheaders_install. The commit forgets to define a macro for__kernel_fsid_tand it will cause type re-definition issue.
Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.fixes
[1/1] selftests/fs/mount-notify: Fix compilation failure.
https://git.kernel.org/vfs/vfs/c/e51bd0e59547 [1/1] selftests/fs/mount-notify: Fix compilation failure. https://git.kernel.org/vfs/vfs/c/e51bd0e59547