Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] ioctl_ficlone03.c: Support test on more filesystems
@ 2025-03-26 14:22 Petr Vorel
  2025-07-11 14:15 ` Cyril Hrubis
  0 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2025-03-26 14:22 UTC (permalink / raw)
  To: ltp

ext[2-4] don't support immutable.

vfat, exfat and ntfs would fail, therefore not supported:
ioctl_ficlone03.c:80: TBROK: ioctl(7,((((1U) << (((0+8)+8)+14)) | ((('f')) << (0+8)) | (((2)) << 0) | ((((sizeof(long)))) << ((0+8)+8)))),...) failed: EINVAL (22)
ioctl_ficlone03.c:95: TWARN: ioctl(7,((((2U) << (((0+8)+8)+14)) | ((('f')) << (0+8)) | (((1)) << 0) | ((((sizeof(long)))) << ((0+8)+8)))),...) failed: EINVAL (22)
ioctl_ficlone03.c:97: TWARN: ioctl(7,((((1U) << (((0+8)+8)+14)) | ((('f')) << (0+8)) | (((2)) << 0) | ((((sizeof(long)))) << ((0+8)+8)))),...) failed: EINVAL (22)
ioctl_ficlone03.c:104: TWARN: close(-1) failed: EBADF (9)

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Based on Andrea's patch which fixes 32bit failure on Bcachefs:

https://patchwork.ozlabs.org/project/ltp/patch/20250326-fix_ioctl_ficlone03_32bit_bcachefs-v1-1-554a0315ebf5@suse.com/

NOTE: if found useful I'll recheck whether test works on older kernels.

 .../kernel/syscalls/ioctl/ioctl_ficlone03.c    | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c b/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
index 6716423d9c..f4e7bf2906 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
@@ -43,16 +43,22 @@ static struct tcase {
 static void run(unsigned int n)
 {
 	struct tcase *tc = &tcases[n];
+	int errno_exp = tc->errno_exp;
+	long fs_type = tst_fs_type(MNTPOINT);
+
+	/* ext[234] and tmpfs does not support immutable destination */
+	if (errno_exp == EPERM &&
+		(fs_type == TST_EXT234_MAGIC || fs_type == TST_TMPFS_MAGIC)) {
+		errno_exp = EOPNOTSUPP;
+	}
 
 	TST_EXP_FAIL(ioctl(*tc->dst_fd, FICLONE, *tc->src_fd),
-		tc->errno_exp,
-		"%s", tc->msg);
+		errno_exp, "%s", tc->msg);
 
 	clone_range->src_fd = *tc->src_fd;
 
 	TST_EXP_FAIL(ioctl(*tc->dst_fd, FICLONERANGE, clone_range),
-		tc->errno_exp,
-		"%s", tc->msg);
+		errno_exp, "%s", tc->msg);
 }
 
 static void setup(void)
@@ -117,6 +123,10 @@ static struct tst_test test = {
 			.mkfs_ver = "mkfs.xfs >= 1.5.0",
 			.mkfs_opts = (const char *const []) {"-m", "reflink=1", NULL},
 		},
+		{.type = "ext2"},
+		{.type = "ext3"},
+		{.type = "ext4"},
+		{.type = "tmpfs"},
 		{}
 	},
 	.bufs = (struct tst_buffers []) {
-- 
2.49.0


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

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

end of thread, other threads:[~2025-07-22 13:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-26 14:22 [LTP] [PATCH 1/1] ioctl_ficlone03.c: Support test on more filesystems Petr Vorel
2025-07-11 14:15 ` Cyril Hrubis
2025-07-22 10:23   ` Petr Vorel
2025-07-22 11:41     ` Jan Kara
2025-07-22 13:50       ` Petr Vorel

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