* [PATCH] selftests/filesystems: Skip file_stressor test on NFS root
@ 2025-08-28 10:30 Anders Roxell
0 siblings, 0 replies; only message in thread
From: Anders Roxell @ 2025-08-28 10:30 UTC (permalink / raw)
To: shuah, brauner
Cc: linux-kselftest, linux-kernel, dan.carpenter, arnd,
benjamin.copeland, Anders Roxell
The file_stressor test creates directories in the root filesystem and
performs mount namespace operations that can fail on NFS root filesystems
due to network filesystem restrictions and permission limitations.
Add NFS root filesystem detection using statfs() to check for
NFS_SUPER_MAGIC and skip the test gracefully when running on NFS root,
providing a clear message about why the test was skipped.
This prevents spurious test failures in CI environments that use NFS
root while preserving the test's ability to catch SLAB_TYPESAFE_BY_RCU
related bugs on local filesystems where it can run properly.
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
tools/testing/selftests/filesystems/file_stressor.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/filesystems/file_stressor.c b/tools/testing/selftests/filesystems/file_stressor.c
index 01dd89f8e52f..b9dfe0b6b125 100644
--- a/tools/testing/selftests/filesystems/file_stressor.c
+++ b/tools/testing/selftests/filesystems/file_stressor.c
@@ -10,12 +10,14 @@
#include <string.h>
#include <sys/stat.h>
#include <sys/mount.h>
+#include <sys/vfs.h>
#include <unistd.h>
#include "../kselftest_harness.h"
#include <linux/types.h>
#include <linux/mount.h>
+#include <linux/magic.h>
#include <sys/syscall.h>
static inline int sys_fsopen(const char *fsname, unsigned int flags)
@@ -58,8 +60,13 @@ FIXTURE(file_stressor) {
FIXTURE_SETUP(file_stressor)
{
+ struct statfs sfs;
int fd_context;
+ /* Skip test if root filesystem is NFS */
+ if (statfs("/", &sfs) == 0 && sfs.f_type == NFS_SUPER_MAGIC)
+ SKIP(return, "Test requires local root filesystem, NFS root detected");
+
ASSERT_EQ(unshare(CLONE_NEWNS), 0);
ASSERT_EQ(mount(NULL, "/", NULL, MS_SLAVE | MS_REC, NULL), 0);
ASSERT_EQ(mkdir("/slab_typesafe_by_rcu", 0755), 0);
--
2.50.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-28 10:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-28 10:30 [PATCH] selftests/filesystems: Skip file_stressor test on NFS root Anders Roxell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).