Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v4] mount_setattr02.c: Check mount_setattr attr propagation
Date: Mon, 28 Jul 2025 17:37:30 +0200	[thread overview]
Message-ID: <aIeZOpdFQ4KLRzsH@yuki.lan> (raw)
In-Reply-To: <20250724134052.568308-1-wegao@suse.com>

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      reply	other threads:[~2025-07-28 15:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-17  2:04 [LTP] [PATCH v1] mount_setattr02.c: Check mount_setattr attr.propagation Wei Gao via ltp
2025-02-18 15:18 ` Petr Vorel
2025-02-19  8:47   ` Wei Gao via ltp
2025-02-19  9:05     ` Petr Vorel
2025-02-19  9:51       ` Wei Gao via ltp
2025-02-19 11:24         ` Petr Vorel
2025-02-19  8:29 ` [LTP] [PATCH v2] " Wei Gao via ltp
2025-02-21 12:54   ` Petr Vorel
2025-02-24  1:44     ` Wei Gao via ltp
2025-03-19 11:41   ` [LTP] [PATCH v3] mount_setattr02.c: Check mount_setattr attr propagation Wei Gao via ltp
2025-07-11  9:21     ` Cyril Hrubis
2025-07-24 13:40     ` [LTP] [PATCH v4] " Wei Gao via ltp
2025-07-28 15:37       ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aIeZOpdFQ4KLRzsH@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=wegao@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox