@@ -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 []) {
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(-)