selftests/filesystems: Move file_stressor to dedicated subdirectory
PATCH v2 1/2 selftests/filesystems: Move file_stressor to dedicated subdirectory
The file_stressor test requires a 30-minute timeout (1800 seconds) due to its 15-minute runtime plus setup/teardown overhead. This is significantly longer than the default 45-second timeout used by other filesystem tests.
Move file_stressor into its own subdirectory (filesystems/file_stressor/) with a dedicated settings file to isolate its timeout configuration. This prevents the long timeout from affecting other fast-running tests in the filesystems/ directory.
This restructuring follows the pattern used by other selftests with special requirements and ensures proper timeout handling in CI/CD environments while maintaining the default 45-second timeout for other filesystem tests.
---
v1 -> v2
- Add .gitignore file in filesystems/file_stressor/ to ignore compiled binary
- Update filesystems/.gitignore to remove file_stressor entry
Link to v1: https://lore.kernel.org/all/[email protected]/
tools/testing/selftests/Makefile | 1 +
tools/testing/selftests/filesystems/.gitignore | 1 -
tools/testing/selftests/filesystems/Makefile | 2 +-
.../testing/selftests/filesystems/file_stressor/.gitignore | 2 ++
tools/testing/selftests/filesystems/file_stressor/Makefile | 6 ++++++
.../filesystems/{ => file_stressor}/file_stressor.c | 0
tools/testing/selftests/filesystems/file_stressor/settings | 3 +++
7 files changed, 13 insertions(+), 2 deletions(-)
create mode 100644 tools/testing/selftests/filesystems/file_stressor/.gitignore
create mode 100644 tools/testing/selftests/filesystems/file_stressor/Makefile
rename tools/testing/selftests/filesystems/{ => file_stressor}/file_stressor.c (100%)
create mode 100644 tools/testing/selftests/filesystems/file_stressor/settingstools/testing/selftests/Makefile +1 -0
@@ -34,6 +34,7 @@ TARGETS += filesystems TARGETS += filesystems/binderfs TARGETS += filesystems/epoll TARGETS += filesystems/fat +TARGETS += filesystems/file_stressor TARGETS += filesystems/overlayfs TARGETS += filesystems/statmount TARGETS += filesystems/mount-notify
tools/testing/selftests/filesystems/.gitignore +0 -1
@@ -2,6 +2,5 @@ dnotify_test devpts_pts fclog -file_stressor anon_inode_test kernfs_test
tools/testing/selftests/filesystems/Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 CFLAGS += $(KHDR_INCLUDES) -TEST_GEN_PROGS := devpts_pts file_stressor anon_inode_test kernfs_test fclog +TEST_GEN_PROGS := devpts_pts anon_inode_test kernfs_test fclog TEST_GEN_PROGS_EXTENDED := dnotify_test include ../lib.mk
tools/testing/selftests/filesystems/file_stressor/.gitignore new file +2 -0
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +file_stressor
tools/testing/selftests/filesystems/file_stressor/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 + +CFLAGS += $(KHDR_INCLUDES) +TEST_GEN_PROGS := file_stressor + +include ../../lib.mk
tools/testing/selftests/filesystems/file_stressor/file_stressor.c renamed from tools/testing/selftests/filesystems/file_stressor.c +0 -0
tools/testing/selftests/filesystems/file_stressor/settings new file +3 -0
@@ -0,0 +1,3 @@ +# Timeout for file_stressor test +# The test runs for 900 seconds (15 minutes) plus setup/teardown time +timeout=1800
Signature · 1 line
2.45.1
PATCH v2 2/2 selftests/filesystems: allow security.selinux xattr in listxattr kernfs test
kernfs_test assumes that flistxattr() on /sys/kernel/warn_count always returns an empty list. However, systems with SELinux enabled may expose security.selinux xattr via listxattr() during policy load, which makes the test fail even though kernfs is behaving correctly.
Allow security.selinux xattr in kernfs_listxattr while continuing to reject other unexpected xattrs. Keep the existing user.foo getxattr check unchanged.
This avoids false failures on SELinux-enabled systems while preserving the original purpose of the test.
--- .../selftests/filesystems/kernfs_test.c | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
tools/testing/selftests/filesystems/kernfs_test.c +25 -2
@@ -4,6 +4,8 @@#include <fcntl.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <sys/stat.h> #include <sys/xattr.h>
@@ -12,12 +14,33 @@TEST (kernfs_listxattr) { +char *buf, *xattr; +ssize_t len, ret;int fd; -/* Read-only file that can never have any extended attributes set. */ +/* Read-only file that can never have any extended attributes set. +* However, SELinux may set security.selinux xattr on kernfs files +* during policy load, so we explicitly ignore it. +*/ fd =open ("/sys/kernel/warn_count" ,O_RDONLY |O_CLOEXEC );ASSERT_GE (fd,0 ); -ASSERT_EQ (flistxattr (fd,NULL ,0 ),0 ); + + len =flistxattr (fd,NULL ,0 ); +ASSERT_GE (len,0 ); + +if (len >0 ) { + buf =malloc (len); +ASSERT_NE (buf,NULL ); + + ret =flistxattr (fd, buf, len); +ASSERT_EQ (ret, len); + +for (xattr = buf; xattr < buf + len; xattr +=strlen (xattr) +1 ) +ASSERT_EQ (strcmp (xattr,"security.selinux" ),0 ); + +free (buf); + } +EXPECT_EQ (close (fd),0 ); }
Signature · 1 line
2.45.1
Re: [PATCH v2 2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test
Quoted 49 lines · Disha Goel
kernfs_testassumes thatflistxattr()on/sys/kernel/warn_countalways returns an empty list. However, systems with SELinux enabled may expose security.selinux xattr vialistxattr()during policy load, which makes the test fail even though kernfs is behaving correctly.Allow security.selinux xattr in
kernfs_listxattrwhile continuing to reject other unexpected xattrs. Keep the existing user.foo getxattr check unchanged.This avoids false failures on SELinux-enabled systems while preserving the original purpose of the test.
Signed-off-by Disha Goel <[email protected]>--- .../selftests/filesystems/kernfs_test.c | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)tools/testing/selftests/filesystems/kernfs_test.c +11
-2@@ -4,6 +4,8 @@#include <fcntl.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <sys/stat.h> #include <sys/xattr.h> @@ -12,12 +14,33 @@TEST (kernfs_listxattr) { +char *buf, *xattr; +ssize_t len, ret;int fd; -/* Read-only file that can never have any extended attributes set. */ +/* Read-only file that can never have any extended attributes set. +* However, SELinux may set security.selinux xattr on kernfs files +* during policy load, so we explicitly ignore it. +*/ fd =open ("/sys/kernel/warn_count" ,O_RDONLY |O_CLOEXEC );ASSERT_GE (fd,0 ); -ASSERT_EQ (flistxattr (fd,NULL ,0 ),0 ); + + len =flistxattr (fd,NULL ,0 ); +ASSERT_GE (len,0 );
tools/testing/selftests/filesystems/kernfs_test.c line 39
Quoted 10 lines
tools/testing/selftests/filesystems/kernfs_test.c +10
-0+ +if (len >0 ) { + buf =malloc (len); +ASSERT_NE (buf,NULL ); + + ret =flistxattr (fd, buf, len); +ASSERT_EQ (ret, len); + +for (xattr = buf; xattr < buf + len; xattr +=strlen (xattr) +1 ) +ASSERT_EQ (strcmp (xattr,"security.selinux" ),0 );
Hi Disha,
Yes we did check that this particular file was showing selinux xattrs, so I guess the test's assumption is wrong.
However, looking a bit more closely this test is designed to check that when no xattrs are set then listxattr() always returns 0 and getxattr() returns ENODATA. So having SELinux attributes defeats the purpose of the test.
Maybe a better approach would be to just skip the test if any SELinux attribute (or any attribute) is present on this file. Idk if with SELinux its possible to have a file with no attr, if there is then maybe we should use that file instead.
Regards,
Ojaswin
Quoted 10 lines
tools/testing/selftests/filesystems/kernfs_test.c +4
-0+ +free (buf); + } +EXPECT_EQ (close (fd),0 ); }Signature · 1 line
2.45.1
Re: [PATCH v2 2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test
In reply to Disha GoelQuoted 9 lines · Disha Goel
kernfs_testassumes thatflistxattr()on/sys/kernel/warn_countalways returns an empty list. However, systems with SELinux enabled may expose security.selinux xattr vialistxattr()during policy load, which makes the test fail even though kernfs is behaving correctly.Allow security.selinux xattr in
kernfs_listxattrwhile continuing to reject other unexpected xattrs. Keep the existing user.foo getxattr check unchanged.
Quoted 5 lines
This avoids false failures on SELinux-enabled systems while preserving the original purpose of the test.
Signed-off-by Disha Goel<[email protected]>---
Hi Disha,
I have tested this patch on my ppc64le system and it works as expected.
Test Environment:
- Kernel: Linux (mainline)
Logs
====
# make -C tools/testing/selftests/filesystems run_tests make: Entering directory '/root/linux/tools/testing/selftests/filesystems' # timeout set to 45 # selftests: filesystems: kernfs_test # TAP version 13 # 1..2 # # Starting 2 tests from 1 test cases. # # RUN global.kernfs_listxattr ... # # OK global.kernfs_listxattr # ok 1 global.kernfs_listxattr # # RUN global.kernfs_getxattr ... # # OK global.kernfs_getxattr # ok 2 global.kernfs_getxattr # # PASSED: 2 / 2 tests passed. # # Totals: pass:2 fail:0 xfail:0 xpass:0 skip:0 error:0 ok 3 selftests: filesystems: kernfs_test |All filesystem selftests also passed without issues.|
Please add below tag.
Thanks,
Yeswanth Krishna
Quoted 52 lines
.../selftests/filesystems/kernfs_test.c | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)tools/testing/selftests/filesystems/kernfs_test.c +25
-2@@ -4,6 +4,8 @@#include <fcntl.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <sys/stat.h> #include <sys/xattr.h> @@ -12,12 +14,33 @@TEST (kernfs_listxattr) { +char *buf, *xattr; +ssize_t len, ret;int fd; -/* Read-only file that can never have any extended attributes set. */ +/* Read-only file that can never have any extended attributes set. +* However, SELinux may set security.selinux xattr on kernfs files +* during policy load, so we explicitly ignore it. +*/ fd =open ("/sys/kernel/warn_count" ,O_RDONLY |O_CLOEXEC );ASSERT_GE (fd,0 ); -ASSERT_EQ (flistxattr (fd,NULL ,0 ),0 ); + + len =flistxattr (fd,NULL ,0 ); +ASSERT_GE (len,0 ); + +if (len >0 ) { + buf =malloc (len); +ASSERT_NE (buf,NULL ); + + ret =flistxattr (fd, buf, len); +ASSERT_EQ (ret, len); + +for (xattr = buf; xattr < buf + len; xattr +=strlen (xattr) +1 ) +ASSERT_EQ (strcmp (xattr,"security.selinux" ),0 ); + +free (buf); + } +EXPECT_EQ (close (fd),0 ); }
Quoted 103 lines · Disha Goel
The
file_stressortest requires a 30-minute timeout (1800 seconds) due to its 15-minute runtime plus setup/teardown overhead. This is significantly longer than the default 45-second timeout used by other filesystem tests.Move
file_stressorinto its own subdirectory (filesystems/file_stressor/) with a dedicated settings file to isolate its timeout configuration. This prevents the long timeout from affecting other fast-running tests in the filesystems/ directory.This restructuring follows the pattern used by other selftests with special requirements and ensures proper timeout handling in CI/CD environments while maintaining the default 45-second timeout for other filesystem tests.
Reported-by kernel test robot <[email protected]>Signed-off-by Disha Goel <[email protected]>---
v1 -> v2
- Add .gitignore file in filesystems/file_stressor/ to ignore compiled binary
- Update filesystems/.gitignore to removefile_stressorentryLink to v1: https://lore.kernel.org/all/[email protected]/
tools/testing/selftests/Makefile | 1 + tools/testing/selftests/filesystems/.gitignore | 1 - tools/testing/selftests/filesystems/Makefile | 2 +- .../testing/selftests/filesystems/file_stressor/.gitignore | 2 ++ tools/testing/selftests/filesystems/file_stressor/Makefile | 6 ++++++ .../filesystems/{ => file_stressor}/file_stressor.c | 0 tools/testing/selftests/filesystems/file_stressor/settings | 3 +++ 7 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/filesystems/file_stressor/.gitignore create mode 100644 tools/testing/selftests/filesystems/file_stressor/Makefile rename tools/testing/selftests/filesystems/{ => file_stressor}/file_stressor.c (100%) create mode 100644 tools/testing/selftests/filesystems/file_stressor/settingstools/testing/selftests/Makefile +1
-0@@ -34,6 +34,7 @@ TARGETS += filesystems TARGETS += filesystems/binderfs TARGETS += filesystems/epoll TARGETS += filesystems/fat +TARGETS += filesystems/file_stressor TARGETS += filesystems/overlayfs TARGETS += filesystems/statmount TARGETS += filesystems/mount-notifytools/testing/selftests/filesystems/.gitignore +0
-1@@ -2,6 +2,5 @@ dnotify_test devpts_pts fclog -file_stressor anon_inode_test kernfs_testtools/testing/selftests/filesystems/Makefile +1
-1@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 CFLAGS += $(KHDR_INCLUDES) -TEST_GEN_PROGS := devpts_pts file_stressor anon_inode_test kernfs_test fclog +TEST_GEN_PROGS := devpts_pts anon_inode_test kernfs_test fclog TEST_GEN_PROGS_EXTENDED := dnotify_test include ../lib.mktools/testing/selftests/filesystems/file_stressor/.gitignore new file +2
-0@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +file_stressortools/testing/selftests/filesystems/file_stressor/Makefile new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 + +CFLAGS += $(KHDR_INCLUDES) +TEST_GEN_PROGS := file_stressor + +include ../../lib.mktools/testing/selftests/filesystems/file_stressor/file_stressor.c renamed from tools/testing/selftests/filesystems/file_stressor.c +0
-0tools/testing/selftests/filesystems/file_stressor/settings new file +0
-0
tools/testing/selftests/filesystems/file_stressor/settings line 3
Quoted 3 lines
tools/testing/selftests/filesystems/file_stressor/settings new file +3
-0@@ -0,0 +1,3 @@ +# Timeout for file_stressor test +# The test runs for 900 seconds (15 minutes) plus setup/teardown time +timeout=1800
Look good to me Disha. I hope you've tested this on the setup where its failing to confirm we are able to reliably pass with the patch.
Other than that, feel free to add:
Regards,
Ojaswin
Quoted 2 lines
2.45.1
Quoted 9 lines · Disha Goel
The
file_stressortest requires a 30-minute timeout (1800 seconds) due to its 15-minute runtime plus setup/teardown overhead. This is significantly longer than the default 45-second timeout used by other filesystem tests.Move
file_stressorinto its own subdirectory (filesystems/file_stressor/) with a dedicated settings file to isolate its timeout configuration. This prevents the long timeout from affecting other fast-running tests in the filesystems/ directory.
Quoted 7 lines
This restructuring follows the pattern used by other selftests with special requirements and ensures proper timeout handling in CI/CD environments while maintaining the default 45-second timeout for other filesystem tests.
Reported-by kernel test robot<[email protected]>Signed-off-by Disha Goel<[email protected]>
Hi Disha,
I have tested this patch on my ppc64le system and it works as expected.
Test Environment:
- Kernel: Linux (mainline)
Logs
====
Test Results:
The file_stressor test executed successfully in tools/testing/selftests:
# make TARGETS=filesystems/file_stressor/ run_tests CC file_stressor # timeout set to 1800 # selftests: filesystems/file_stressor: file_stressor # TAP version 13 # 1..1 # # Starting 1 tests from 1 test cases. # # RUN file_stressor.slab_typesafe_by_rcu ... # # OK file_stressor.slab_typesafe_by_rcu # ok 1 file_stressor.slab_typesafe_by_rcu # # PASSED: 1 / 1 tests passed. # # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 ok 1 selftests: filesystems/file_stressor: file_stressor
Please add below tag.
Thanks,
Yeswanth Krishna
Quoted 89 lines
---
v1 -> v2
- Add .gitignore file in filesystems/file_stressor/ to ignore compiled binary
- Update filesystems/.gitignore to removefile_stressorentryLink to v1:https://lore.kernel.org/all/[email protected]/
tools/testing/selftests/Makefile | 1 + tools/testing/selftests/filesystems/.gitignore | 1 - tools/testing/selftests/filesystems/Makefile | 2 +- .../testing/selftests/filesystems/file_stressor/.gitignore | 2 ++ tools/testing/selftests/filesystems/file_stressor/Makefile | 6 ++++++ .../filesystems/{ => file_stressor}/file_stressor.c | 0 tools/testing/selftests/filesystems/file_stressor/settings | 3 +++ 7 files changed, 13 insertions(+), 2 deletions(-)create mode 100644
tools/testing/selftests/filesystems/file_stressor/.gitignorecreate mode 100644tools/testing/selftests/filesystems/file_stressor/Makefilerenametools/testing/selftests/filesystems/{=>file_stressor}/file_stressor.c(100%) create mode 100644tools/testing/selftests/filesystems/file_stressor/settingstools/testing/selftests/Makefile +1
-0@@ -34,6 +34,7 @@ TARGETS += filesystems TARGETS += filesystems/binderfs TARGETS += filesystems/epoll TARGETS += filesystems/fat +TARGETS += filesystems/file_stressor TARGETS += filesystems/overlayfs TARGETS += filesystems/statmount TARGETS += filesystems/mount-notifytools/testing/selftests/filesystems/.gitignore +0
-1@@ -2,6 +2,5 @@ dnotify_test devpts_pts fclog -file_stressor anon_inode_test kernfs_testtools/testing/selftests/filesystems/Makefile +1
-1@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 CFLAGS += $(KHDR_INCLUDES) -TEST_GEN_PROGS := devpts_pts file_stressor anon_inode_test kernfs_test fclog +TEST_GEN_PROGS := devpts_pts anon_inode_test kernfs_test fclog TEST_GEN_PROGS_EXTENDED := dnotify_test include ../lib.mktools/testing/selftests/filesystems/file_stressor/.gitignore new file +2
-0@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +file_stressortools/testing/selftests/filesystems/file_stressor/Makefile new file +6
-0@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0 + +CFLAGS += $(KHDR_INCLUDES) +TEST_GEN_PROGS := file_stressor + +include ../../lib.mktools/testing/selftests/filesystems/file_stressor/file_stressor.c renamed from tools/testing/selftests/filesystems/file_stressor.c +0
-0tools/testing/selftests/filesystems/file_stressor/settings new file +3
-0@@ -0,0 +1,3 @@ +# Timeout for file_stressor test +# The test runs for 900 seconds (15 minutes) plus setup/teardown time +timeout=1800
Christian Brauner
AppliedQuoted 10 lines · Disha Goel
The
file_stressortest requires a 30-minute timeout (1800 seconds) due to its 15-minute runtime plus setup/teardown overhead. This is significantly longer than the default 45-second timeout used by other filesystem tests.Move
file_stressorinto its own subdirectory (filesystems/file_stressor/) with a dedicated settings file to isolate its timeout configuration. This prevents the long timeout from affecting other fast-running tests in the filesystems/ directory.[...]
Applied to the vfs-7.4.misc branch of the vfs/vfs.git tree. Patches in the vfs-7.4.misc 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-7.4.misc
[1/2] selftests/filesystems: Move file_stressor to dedicated subdirectory
https://git.kernel.org/vfs/vfs/c/5550456dad37 [2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test https://git.kernel.org/vfs/vfs/c/cc87d0a97bc0
Quoted 24 lines · Christian Brauner
Quoted 10 lines · Disha Goel
The
file_stressortest requires a 30-minute timeout (1800 seconds) due to its 15-minute runtime plus setup/teardown overhead. This is significantly longer than the default 45-second timeout used by other filesystem tests.Move
file_stressorinto its own subdirectory (filesystems/file_stressor/) with a dedicated settings file to isolate its timeout configuration. This prevents the long timeout from affecting other fast-running tests in the filesystems/ directory.[...]
Applied to the vfs-7.4.misc branch of the vfs/vfs.git tree. Patches in the vfs-7.4.misc 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.
Quoted 7 lines
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs-7.4.misc[1/2] selftests/filesystems: Move
file_stressorto dedicated subdirectoryhttps://git.kernel.org/vfs/vfs/c/5550456dad37 [2/2] selftests/filesystems: allow security.selinux xattr in listxattr kernfs test https://git.kernel.org/vfs/vfs/c/cc87d0a97bc0
Hi Christian,
Thanks for applying the series. One note — v3 of this series was sent on 03/08/26, and patch 2/2 had changes compared to v2. It looks like v2 was applied instead.
v3 patch 2/2 link: https://lore.kernel.org/linux-kselftest/[email protected]/
Could you update the applied commit with the v3 version, or let me know if a re-send is needed?
Signature · 2 lines
Regards, Disha