From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: "Cyril Hrubis" <chrubis@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] refluxfs: Check kernel reflink support before mount
Date: Thu, 13 Aug 2026 10:46:44 +0000 [thread overview]
Message-ID: <6a7da094.a02854e2.9191a.a277@mx.google.com> (raw)
In-Reply-To: <an2Gs6ztBU20B2Ik@yuki.lan>
Hi Cyril,
> Hi!
> > > > + if (TST_RET == -1 && TST_ERR == EOPNOTSUPP)
> > > > + tst_brk(TCONF, "Kernel does not support XFS reflinks");
> > >
> > > Wouldn't it make more sense to add the check for EOPNOTSUPP into the
> > > tst_test.c library?
> >
> > I don't know if we really need to add something in the LTP library,
> > since we have this check only in file_attr02
>
> I mean that we should rather than hacking around it in the tests handle
> EOPNOTSUPP properly in the test libray when mounting filesystems. We do
> enough magick in safe_mount() to support FUSE and handle other corner
> cases, checking for EOPNOTSUPP (possibly with non-standard mount flags)
> does sound like a reasonable extension.
>
> The main point of handling the filesystems in the test library is that
> cleanup (umounting) is handled properly even if the test crashes. If we
> move the code back to the tests like this we lose that.
>
> --
> Cyril Hrubis
> chrubis@suse.cz
Something like this?
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index f95c5fdc5..34430d018 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -993,9 +993,15 @@ int safe_mount(const char *file, const int lineno, void (*cleanup_fn)(void),
"mount.%s failed with %i", filesystemtype, rval);
return -1;
} else if (rval == -1) {
- tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
- "mount(%s, %s, %s, %lu, %p) failed", source, target,
- filesystemtype, mountflags, data);
+ if (errno == EOPNOTSUPP) {
+ tst_brkm_(file, lineno, TCONF | TERRNO, cleanup_fn,
+ "mount(%s, %s, %s, %lu, %p) failed with EOPNOTSUPP", source, target,
+ filesystemtype, mountflags, data);
+ } else {
+ tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
+ "mount(%s, %s, %s, %lu, %p) failed", source, target,
+ filesystemtype, mountflags, data);
+ }
} else {
tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
"Invalid mount(%s, %s, %s, %lu, %p) return value %d",
diff --git a/testcases/kernel/syscalls/file_attr/file_attr02.c b/testcases/kernel/syscalls/file_attr/file_attr02.c
index f6625985a..28c1c7ca6 100644
--- a/testcases/kernel/syscalls/file_attr/file_attr02.c
+++ b/testcases/kernel/syscalls/file_attr/file_attr02.c
@@ -45,13 +45,7 @@ static void setup(void)
struct stat statbuf;
SAFE_MKDIR(MNTPOINT, 0755);
- TEST(mount(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL));
-
- if (TST_RET == -1 && TST_ERR == EOPNOTSUPP)
- tst_brk(TCONF, "Kernel does not support XFS reflinks");
-
- if (TST_RET)
- tst_brk(TBROK | TTERRNO, "Mount failed");
+ SAFE_MOUNT(tst_device->dev, MNTPOINT, tst_device->fs_type, 0, NULL);
SAFE_STAT(MNTPOINT, &statbuf);
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-08-13 10:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 15:22 [LTP] [PATCH] refluxfs: Check kernel reflink support before mount Martin Doucha
2026-08-12 15:49 ` Cyril Hrubis
2026-08-13 6:36 ` Andrea Cervesato via ltp
2026-08-13 10:12 ` Cyril Hrubis
2026-08-13 10:46 ` Andrea Cervesato via ltp [this message]
2026-08-13 11:46 ` Cyril Hrubis
2026-08-13 13:49 ` Martin Doucha
2026-08-13 14:15 ` Cyril Hrubis
2026-08-12 16:02 ` [LTP] " linuxtestproject.agent
2026-08-13 6:29 ` [LTP] [PATCH] " Andrea Cervesato via ltp
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a7da094.a02854e2.9191a.a277@mx.google.com \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.com \
--cc=chrubis@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox