[LTP] [PATCH v4] mount_setattr02.c: Check mount_setattr attr propagation
Cyril Hrubis
chrubis@suse.cz
Mon Jul 28 17:37:30 CEST 2025
Hi!
Pushed with some changes, thanks.
- We have to move the SAFE_UMOUNT(tmpdir) to the run() otherwise the test
fails to cleanup() with -i 2
- Make sure that the slavedir was mounted shared before making it slave
- Minor adjustenment to the test description
diff --git a/testcases/kernel/syscalls/mount_setattr/mount_setattr02.c b/testcases/kernel/syscalls/mount_setattr/mount_setattr02.c
index 640778f7c..bb246ed10 100644
--- a/testcases/kernel/syscalls/mount_setattr/mount_setattr02.c
+++ b/testcases/kernel/syscalls/mount_setattr/mount_setattr02.c
@@ -5,7 +5,7 @@
/*\
* This test is checking if the propagation field of the
- * structure is handled properly.
+ * mount_attr structure is handled properly.
*
* - EINVAL with propagation set to -1
* - When propagation is set to 0 it's not changed
@@ -68,10 +68,8 @@ static bool check_mount_type(const char *path, enum mount_type type_to_check)
static void cleanup(void)
{
- if (mounted) {
- SAFE_UMOUNT(slavedir);
+ if (mounted)
SAFE_UMOUNT(tmpdir);
- }
}
static void setup(void)
@@ -109,9 +107,11 @@ static void run(void)
attr.propagation = MS_SLAVE;
SAFE_MOUNT(tmpdir, slavedir, "none", MS_BIND, NULL);
+ TST_EXP_EQ_LI(check_mount_type(slavedir, MOUNT_TYPE_SHARED), 1);
TST_EXP_PASS_SILENT(mount_setattr(-1, slavedir, 0, &attr, sizeof(attr)));
TST_EXP_EQ_LI(check_mount_type(slavedir, MOUNT_TYPE_MASTER), 1);
TST_EXP_EQ_LI(check_mount_type(slavedir, MOUNT_TYPE_SHARED), 0);
+ SAFE_UMOUNT(slavedir);
attr.propagation = MS_PRIVATE;
TST_EXP_PASS_SILENT(mount_setattr(-1, tmpdir, 0, &attr, sizeof(attr)));
--
Cyril Hrubis
chrubis@suse.cz
More information about the ltp
mailing list