Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] refluxfs: Check kernel reflink support before mount
Date: Thu, 13 Aug 2026 13:46:20 +0200	[thread overview]
Message-ID: <an2ujOLYL0g1WyEX@yuki.lan> (raw)
In-Reply-To: <6a7da094.a02854e2.9191a.a277@mx.google.com>

Hi!
> 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);

Yes. If we do not do this we are going to open code the check over and
over.

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2026-08-13 11:46 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
2026-08-13 11:46         ` Cyril Hrubis [this message]
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=an2ujOLYL0g1WyEX@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=andrea.cervesato@suse.com \
    --cc=ltp@lists.linux.it \
    /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