From: Martin Doucha <mdoucha@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 3/3] file_attr02: Simplify device mounting
Date: Fri, 14 Aug 2026 14:49:38 +0200 [thread overview]
Message-ID: <20260814124943.36853-4-mdoucha@suse.cz> (raw)
In-Reply-To: <20260814124943.36853-1-mdoucha@suse.cz>
The file_attr02 test creates an XFS partition with reflinks enabled.
However, some kernels cannot mount such partitions so the test
needs to check kernel support. The LTP library can now do the check
internally so use this feature instead of mounting explicitly in setup().
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
.../kernel/syscalls/file_attr/file_attr02.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/testcases/kernel/syscalls/file_attr/file_attr02.c b/testcases/kernel/syscalls/file_attr/file_attr02.c
index f6625985a..0adfa5f6e 100644
--- a/testcases/kernel/syscalls/file_attr/file_attr02.c
+++ b/testcases/kernel/syscalls/file_attr/file_attr02.c
@@ -9,7 +9,6 @@
* currently implementing the features we need.
*/
-#include <sys/mount.h>
#include "tst_test.h"
#include "lapi/fs.h"
@@ -44,15 +43,6 @@ 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_STAT(MNTPOINT, &statbuf);
dfd = SAFE_OPEN(MNTPOINT, O_RDONLY);
@@ -82,9 +72,6 @@ static void cleanup(void)
if (dfd != -1)
SAFE_CLOSE(dfd);
-
- if (tst_is_mounted(MNTPOINT))
- SAFE_UMOUNT(MNTPOINT);
}
static struct tst_test test = {
@@ -92,10 +79,12 @@ static struct tst_test test = {
.setup = setup,
.cleanup = cleanup,
.needs_root = 1,
- .format_device = 1,
+ .mount_device = 1,
+ .mntpoint = MNTPOINT,
.filesystems = (struct tst_fs []) {
{
.type = "xfs",
+ .mount_check_support = 1,
.mkfs_opts = (const char *const[]){
"-m", "reflink=1", NULL
},
--
2.54.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-08-14 12:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 12:49 [LTP] [PATCH 0/3] Add optional kernel support checks for filesystem features Martin Doucha
2026-08-14 12:49 ` [LTP] [PATCH 1/3] struct tst_fs: Add flag for checking filesystem mount support in kernel Martin Doucha
2026-08-14 13:05 ` [LTP] " linuxtestproject.agent
2026-08-18 7:51 ` Andrea Cervesato via ltp
2026-08-18 9:21 ` Martin Doucha
2026-08-18 9:35 ` [LTP] [PATCH 1/3] " Andrea Cervesato via ltp
2026-08-20 15:41 ` Petr Vorel
2026-08-14 12:49 ` [LTP] [PATCH 2/3] refluxfs: Check kernel reflink support before mount Martin Doucha
2026-08-18 9:35 ` Andrea Cervesato via ltp
2026-08-14 12:49 ` Martin Doucha [this message]
2026-08-18 9:35 ` [LTP] [PATCH 3/3] file_attr02: Simplify device mounting 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=20260814124943.36853-4-mdoucha@suse.cz \
--to=mdoucha@suse.cz \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.