Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] refluxfs: Check kernel reflink support before mount
@ 2026-08-12 15:22 Martin Doucha
  2026-08-12 15:49 ` Cyril Hrubis
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Martin Doucha @ 2026-08-12 15:22 UTC (permalink / raw)
  To: ltp

On some systems, mkfs.xfs can format XFS partition with reflink support
but the kernel then cannot mount it. Check for kernel reflink support
in setup() before mount.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/cve/refluxfs.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/testcases/cve/refluxfs.c b/testcases/cve/refluxfs.c
index e41f35c53..277d56bb7 100644
--- a/testcases/cve/refluxfs.c
+++ b/testcases/cve/refluxfs.c
@@ -38,6 +38,7 @@
  */
 
 #include <pwd.h>
+#include <sys/mount.h>
 
 #include "tst_test.h"
 #include "tst_safe_prw.h"
@@ -94,6 +95,15 @@ static void setup(void)
 	int probe_fd, probe_dio_fd;
 	struct stat sb;
 
+	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_STAT(MNTPOINT, &sb);
 	blksize = sb.st_blksize;
 
@@ -197,6 +207,11 @@ static void cleanup(void)
 	free(tbuf);
 	free(wbuf);
 	free(rbuf);
+
+	SAFE_SETEUID(0);
+
+	if (tst_is_mounted(MNTPOINT))
+		SAFE_UMOUNT(MNTPOINT);
 }
 
 static struct tst_test test = {
@@ -205,8 +220,7 @@ static struct tst_test test = {
 	.cleanup = cleanup,
 	.runtime = 180,
 	.needs_root = 1,
-	.mount_device = 1,
-	.mntpoint = MNTPOINT,
+	.format_device = 1,
 	.filesystems = (struct tst_fs []) {
 		{
 			.type = "xfs",
-- 
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] refluxfs: Check kernel reflink support before mount
  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-12 16:02 ` [LTP] " linuxtestproject.agent
  2026-08-13  6:29 ` [LTP] [PATCH] " Andrea Cervesato via ltp
  2 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2026-08-12 15:49 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

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?

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] refluxfs: Check kernel reflink support before mount
  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-12 16:02 ` linuxtestproject.agent
  2026-08-13  6:29 ` [LTP] [PATCH] " Andrea Cervesato via ltp
  2 siblings, 0 replies; 5+ messages in thread
From: linuxtestproject.agent @ 2026-08-12 16:02 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

Hi Martin,

On Aug 12, 2026, Martin Doucha wrote:
> refluxfs: Check kernel reflink support before mount

Verdict - Reviewed

---
Note:

The agent can sometimes produce false positives although often its
findings are genuine. If you find issues with the review, please
comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] refluxfs: Check kernel reflink support before mount
  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-12 16:02 ` [LTP] " linuxtestproject.agent
@ 2026-08-13  6:29 ` Andrea Cervesato via ltp
  2 siblings, 0 replies; 5+ messages in thread
From: Andrea Cervesato via ltp @ 2026-08-13  6:29 UTC (permalink / raw)
  To: Martin Doucha; +Cc: ltp

Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH] refluxfs: Check kernel reflink support before mount
  2026-08-12 15:49 ` Cyril Hrubis
@ 2026-08-13  6:36   ` Andrea Cervesato via ltp
  0 siblings, 0 replies; 5+ messages in thread
From: Andrea Cervesato via ltp @ 2026-08-13  6:36 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

Hi Cyril,

> > +	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

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-13  6:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-12 16:02 ` [LTP] " linuxtestproject.agent
2026-08-13  6:29 ` [LTP] [PATCH] " Andrea Cervesato via ltp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox