[LTP] [PATCH 1/1] ioctl_ficlone03.c: Support test on more filesystems

Petr Vorel pvorel@suse.cz
Tue Jul 22 12:23:46 CEST 2025


Hi ext devs,

...
> >  static void setup(void)

> I find it strange that we manage to set the FS_IMMUTABLE_FL in the setup
> with the FS_IOC_SETFLAGS without any error. Maybe it would make sense to
> check with ext devs what is going on here.

> > @@ -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"},
> >  		{}

While I was working on extending [1] LTP ioctl_ficlone03.c to run on more
filesystems [2], I found that ext[2-4] don't support FS_IMMUTABLE_FL.

	immut_fd = open(MNTPOINT"/immutable", O_CREAT | O_RDWR, 0640);
	mnt_file = open(MNTPOINT"/file", O_CREAT | O_RDWR, 0640);
	int attr = FS_IMMUTABLE_FL;
	ioctl(immut_fd, FS_IOC_SETFLAGS, &attr);
	...

	struct file_clone_range *clone_range;
	ioctl(immut_fd, FICLONE, mnt_file),
	ioctl(immut_fd, FICLONERANGE, clone_range),

The last two ioctl() with FICLONE and FICLONERANGE get errno EOPNOTSUPP (instead
of EPERM as on other fs). Cyril raised concern [3], why first ioctl()
FS_IOC_SETFLAGS even works. Shouldn't it also gets EINVAL as vfat, exfat and
ntfs get?

There is not any info in dmesg.

Thanks for any hint.

Kind regards,
Petr

[1] https://patchwork.ozlabs.org/project/ltp/patch/20250326142259.50981-1-pvorel@suse.cz/
[2] https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
[3] https://lore.kernel.org/ltp/aHEccDO8lJiTzbEs@yuki.lan/


More information about the ltp mailing list