[LTP] [PATCH v2 4/7] Add ioctl_ficlone03 test

Cyril Hrubis chrubis@suse.cz
Wed Jul 24 14:20:59 CEST 2024


Hi!
Pushed with a small fix, thanks.

The immutable file has to be on the MNTPOINT as well as th source for
the immutable file, otherwise we get EOPNOTSUPP instead of EPERM since
the check for supported filesystems kicks in first:

diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c b/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
index be069836a..406b64cca 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
@@ -37,7 +37,7 @@ static struct tcase {
        {&wo_file, &rw_file, EBADF, "write-only source"},
        {&rw_file, &dir_fd, EISDIR, "source is a directory"},
        {&dir_fd, &rw_file, EISDIR, "destination is a directory"},
-       {&rw_file, &immut_fd, EPERM, "destination is immutable"},
+       {&mnt_file, &immut_fd, EPERM, "destination is immutable"},
        {&rw_file, &mnt_file, EXDEV, "destination is on a different mount"},
        {&mnt_file, &rw_file, EXDEV, "source is on a different mount"},
 };
@@ -72,7 +72,7 @@ static void setup(void)
        dir_fd = SAFE_OPEN("mydir", O_DIRECTORY, 0640);

        attr = FS_IMMUTABLE_FL;
-       immut_fd = SAFE_OPEN("immutable", O_CREAT | O_RDWR, 0640);
+       immut_fd = SAFE_OPEN(MNTPOINT"/immutable", O_CREAT | O_RDWR, 0640);
        SAFE_IOCTL(immut_fd, FS_IOC_SETFLAGS, &attr);

        mnt_file = SAFE_OPEN(MNTPOINT"/file", O_CREAT | O_RDWR, 0640);


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list