From: Richard Palethorpe <rpalethorpe@suse.de>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1 2/2] syscalls/mount03: Add MS_STRICTATIME subcase
Date: Tue, 29 Nov 2022 13:54:29 +0000 [thread overview]
Message-ID: <875yexua2w.fsf@suse.de> (raw)
In-Reply-To: <1669375875-1943-2-git-send-email-xuyang2018.jy@fujitsu.com>
Hello,
Yang Xu <xuyang2018.jy@fujitsu.com> writes:
> This case should check MS_NOATIME and MS_RELATIME are
> not inside stat f_flags[1] .
>
> [1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d0adde57
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
> testcases/kernel/syscalls/mount/mount03.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/testcases/kernel/syscalls/mount/mount03.c b/testcases/kernel/syscalls/mount/mount03.c
> index 31a858c35..60f9963da 100644
> --- a/testcases/kernel/syscalls/mount/mount03.c
> +++ b/testcases/kernel/syscalls/mount/mount03.c
> @@ -19,6 +19,7 @@
> * - MS_NOSUID - ignore suid and sgid bits
> * - MS_NOATIME - do not update access times
> * - MS_NODIRATIME - only update access_time for directory instead of all types
> + * - MS_STRICTATIME - always update access times
> */
>
> #include <stdio.h>
> @@ -164,6 +165,11 @@ static void test_nodiratime(void)
> test_file_dir_noatime(1, 0);
> }
>
> +static void test_strictatime(void)
> +{
> + test_file_dir_noatime(1, 1);
> +}
> +
> #define FLAG_DESC(x) .flag = x, .flag2 = x, .desc = #x
> #define FLAG_DESC2(x) .flag2 = x, .desc = #x
> static struct tcase {
> @@ -179,6 +185,7 @@ static struct tcase {
> {FLAG_DESC(MS_NOSUID), test_nosuid},
> {FLAG_DESC(MS_NOATIME), test_noatime},
> {FLAG_DESC(MS_NODIRATIME), test_nodiratime},
> + {FLAG_DESC(MS_STRICTATIME), test_strictatime}
> };
>
> static void setup(void)
> @@ -215,6 +222,15 @@ static void run(unsigned int n)
> tc->test();
>
> SAFE_STATFS(MNTPOINT, &stfs);
> + if (tc->flag == MS_STRICTATIME) {
> + if (stfs.f_flags & (MS_NOATIME | MS_RELATIME))
> + tst_res(TFAIL, "statfs() gets the incorrect mount flag");
> + else
> + tst_res(TPASS, "statfs() gets the correct mount flag");
> + cleanup();
> + return;
> + }
We don't need this branch.
> +
> if (stfs.f_flags & tc->flag2)
Could change this to something like
if (stfs.f_flags & tc->flag2
&& !(stfs.f_flags & MS_STRICTATIME && stfs.f_flags & (MS_NOATIME | MS_RELATIME))
Or however you would like to format that.
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-11-29 14:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-25 11:31 [LTP] [PATCH v1 1/2] syscalls/mount03: Add MS_NODIRATIME subcase Yang Xu
2022-11-25 11:31 ` [LTP] [PATCH v1 2/2] syscalls/mount03: Add MS_STRICTATIME subcase Yang Xu
2022-11-29 13:54 ` Richard Palethorpe [this message]
2022-11-30 2:02 ` xuyang2018.jy
2022-12-01 9:48 ` Richard Palethorpe
2022-11-29 14:09 ` [LTP] [PATCH v1 1/2] syscalls/mount03: Add MS_NODIRATIME subcase Richard Palethorpe
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=875yexua2w.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=ltp@lists.linux.it \
--cc=xuyang2018.jy@fujitsu.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