Improve fsconfig test coverage
The fsconfig01.c does not test if FSCONFIG_SET_PATH, FSCONFIG_SET_FD, FSCONFIG_SET_BINARY have any effect, most of the calls there just set dummy "sync" parameter. Getting this right will be difficult since not many filesystems support advance options.
Try to use FSCONFIG_SET_PATH to change journal_path on ext4 filesystem.
losetup -d /dev/loop0 losetup -d /dev/loop1 losetup -d /dev/loop3
dd if=/dev/zero of=loop0.img bs=1M count=100 dd if=/dev/zero of=loop1.img bs=1M count=100 dd if=/dev/zero of=loop3.img bs=1M count=100
losetup /dev/loop0 loop0.img losetup /dev/loop1 loop1.img losetup /dev/loop3 loop3.img
#Setup /dev/loop3 as external journal dev as /dev/loop1 mkfs.ext4 -F -O journal_dev -b 4096 /dev/loop1 mkfs.ext4 -F -O journal_dev -b 4096 /dev/loop3 mkfs.ext4 -F -J device=/dev/loop1 -b 4096 /dev/loop0
#Using fsconfig to change external journal dev from /dev/loop1 -> /dev/loop3
diff --git a/testcases/kernel/syscalls/fsconfig/fsconfig01.c b/testcases/kernel/syscalls/fsconfig/fsconfig01.c
index 678d21815..07cfe3027 100644
--- a/testcases/kernel/syscalls/fsconfig/fsconfig01.c
+++ b/testcases/kernel/syscalls/fsconfig/fsconfig01.c
@@ -30,11 +30,11 @@ static void run(void)
if (TST_RET == -1)
tst_brk(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_FLAG) failed");
- TEST(fsconfig(fd, FSCONFIG_SET_STRING, "source", tst_device->dev, 0));
+ TEST(fsconfig(fd, FSCONFIG_SET_STRING, "source", "/dev/loop0", 0));
if (TST_RET == -1)
tst_brk(TFAIL | TTERRNO, "fsconfig(FSCONFIG_SET_STRING) failed");
- TEST(fsconfig(fd, FSCONFIG_SET_PATH, "sync", tst_device->dev, 0));
+ TEST(fsconfig(fd, FSCONFIG_SET_PATH, "journal_path", "/dev/loop3", 0));
if (TST_RET == -1) {
if (TST_ERR == EOPNOTSUPP)
tst_res(TCONF, "fsconfig(FSCONFIG_SET_PATH) not supported");
@@ -90,5 +90,5 @@ static struct tst_test test = {
.format_device = 1,
.mntpoint = MNTPOINT,
.all_filesystems = 1,
- .skip_filesystems = (const char *const []){"fuse", NULL},
+ .skip_filesystems = (const char *const []){"fuse","ext2","ext3", NULL},
};
#Failure happen report UUID not match tst_test.c:1831: TINFO: === Testing on ext4 === tst_test.c:1170: TINFO: Formatting /dev/loop2 with ext4 opts='' extra opts='' mke2fs 1.47.2 (1-Jan-2025) fsconfig01.c:35: TINFO: sourc=/dev/loop2 [ 1645.265127] EXT4-fs (loop0): external journal device major/minor numbers have changed [ 1645.267906] EXT4-fs (loop0): journal UUID does not match <<<<<<<<<<<<<<<<<<<<<<<<<<<<< fsconfig01.c:67: TFAIL: fsconfig(FSCONFIG_CMD_CREATE) failed: EUCLEAN (117)
#So i make /dev/loop3 has same UUID of /dev/loop2 mkfs.ext4 -F -U d73c9e5e-97e4-4a9c-b17e-75a931b02660 -O journal_dev -b 4096 /dev/loop3 <<< same UUID as /dev/loop2
#Another error will happen tell you has more than one user tst_test.c:1831: TINFO: === Testing on ext4 === tst_test.c:1170: TINFO: Formatting /dev/loop2 with ext4 opts='' extra opts='' mke2fs 1.47.2 (1-Jan-2025) [ 5128.209635] EXT4-fs (loop0): external journal device major/minor numbers have changed [ 5128.210200] EXT4-fs (loop0): External journal has more than one user (unsupported) - 0 <<<<<< fsconfig01.c:63: TFAIL: fsconfig(FSCONFIG_CMD_CREATE) failed: EINVAL (22)
So dynamically switching an external journal device on a live ext4 filesystem using this fsconfig tool is not feasible.
https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/ for FSCONFIG_SET_FD check.
#Another error will happen tell you has more than one user tst_test.c:1831: TINFO: === Testing on ext4 === tst_test.c:1170: TINFO: Formatting /dev/loop2 with ext4 opts='' extra opts='' mke2fs 1.47.2 (1-Jan-2025) [ 5128.209635] EXT4-fs (loop0): external journal device major/minor numbers have changed [ 5128.210200] EXT4-fs (loop0): External journal has more than one user (unsupported) - 0 <<<<<< fsconfig01.c:63: TFAIL: fsconfig(FSCONFIG_CMD_CREATE) failed: EINVAL (22)
So dynamically switching an external journal device on a live ext4 filesystem using this fsconfig tool is not feasible.
The error msg "External journal has more than one user (unsupported) - 0" means loop3 device has no any user, then you can do mkfs.ext4 -F -J device=/dev/loop3 -b 4096 /dev/loop0 <<< this will create user on /dev/loop3 super block.
So before do fsconfig, you can do following sequence steps: mkfs.ext4 -F -J device=/dev/loop1 -b 4096 /dev/loop0 mkfs.ext4 -F -J device=/dev/loop3 -b 4096 /dev/loop0 mkfs.ext4 -F -J device=/dev/loop1 -b 4096 /dev/loop0 TEST(fsconfig(fd, FSCONFIG_SET_PATH, "journal_path", "/dev/loop3", 0));
Finally you can check super block of /dev/loop0, the journal device should point to /dev/loop3.
https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/ for test FSCONFIG_SET_PATH