public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: "xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com>
Cc: "ltp@lists.linux.it" <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v1 2/2] syscalls/mount03: Add MS_STRICTATIME subcase
Date: Thu, 01 Dec 2022 09:48:52 +0000	[thread overview]
Message-ID: <87tu2fih2i.fsf@suse.de> (raw)
In-Reply-To: <1ac38da9-21a1-2c37-2c08-593c0b337927@fujitsu.com>


"xuyang2018.jy@fujitsu.com" <xuyang2018.jy@fujitsu.com> writes:

> Hi Richard
>
>> 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))
>
> I try it, but case reports fail because stfs.f_flags doesn't contain 
> MS_STRICTATIME flag.  Sorry, I guess my commit message only mentioned

Ah, sorry, it should be something like:

if (stfs.f_flags & tc->flag2
     && (tc->flag2 != MS_STRICTATIME || !(stfs.f_flags & MS_STRICTATIME
     && stfs.f_flags & (MS_NOATIME | MS_RELATIME)))

but actually this is getting kind of messy now. So I'll merge it as you
sent it. Thanks!

-- 
Thank you,
Richard.

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

  reply	other threads:[~2022-12-01  9:55 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
2022-11-30  2:02     ` xuyang2018.jy
2022-12-01  9:48       ` Richard Palethorpe [this message]
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=87tu2fih2i.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