* [LTP] [PATCH] syscalls/statx01: Add exit condition when parsing /proc/self/mountinfo
@ 2022-12-07 10:36 Yang Xu
2022-12-12 15:20 ` Richard Palethorpe
0 siblings, 1 reply; 3+ messages in thread
From: Yang Xu @ 2022-12-07 10:36 UTC (permalink / raw)
To: ltp
When using user filesystem such as overlayfs, the current parsing way can't
work well.
63 66 8:3 / /sysroot rw,relatime - ext4 /dev/sda3 rw,seclabel
43 66 8:3 /ostree/deploy/rhivos/var /var rw,relatime shared:3 - ext4 /dev/sda3 rw,seclabel
So add the exit condition for statx.mnt_id check so it can skip the
underflying filesystem and parse the correct user fileystem's mnt_id.
Fixes: #1001
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
testcases/kernel/syscalls/statx/statx01.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
index 60b50958b..931aa60c1 100644
--- a/testcases/kernel/syscalls/statx/statx01.c
+++ b/testcases/kernel/syscalls/statx/statx01.c
@@ -68,7 +68,8 @@ static void test_mnt_id(struct statx *buf)
if (sscanf(line, "%"SCNu64" %*d %d:%d", &mnt_id, &line_mjr, &line_mnr) != 3)
continue;
- if (line_mjr == buf->stx_dev_major && line_mnr == buf->stx_dev_minor)
+ if (line_mjr == buf->stx_dev_major && line_mnr == buf->stx_dev_minor &&
+ mnt_id == buf->stx_mnt_id)
break;
}
--
2.27.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] syscalls/statx01: Add exit condition when parsing /proc/self/mountinfo
2022-12-07 10:36 [LTP] [PATCH] syscalls/statx01: Add exit condition when parsing /proc/self/mountinfo Yang Xu
@ 2022-12-12 15:20 ` Richard Palethorpe
2022-12-13 1:51 ` xuyang2018.jy
0 siblings, 1 reply; 3+ messages in thread
From: Richard Palethorpe @ 2022-12-12 15:20 UTC (permalink / raw)
To: Yang Xu; +Cc: ltp
Hello,
Yang Xu <xuyang2018.jy@fujitsu.com> writes:
> When using user filesystem such as overlayfs, the current parsing way can't
> work well.
>
> 63 66 8:3 / /sysroot rw,relatime - ext4 /dev/sda3 rw,seclabel
> 43 66 8:3 /ostree/deploy/rhivos/var /var rw,relatime shared:3 - ext4 /dev/sda3 rw,seclabel
>
> So add the exit condition for statx.mnt_id check so it can skip the
> underflying filesystem and parse the correct user fileystem's mnt_id.
>
> Fixes: #1001
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
> testcases/kernel/syscalls/statx/statx01.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
> index 60b50958b..931aa60c1 100644
> --- a/testcases/kernel/syscalls/statx/statx01.c
> +++ b/testcases/kernel/syscalls/statx/statx01.c
> @@ -68,7 +68,8 @@ static void test_mnt_id(struct statx *buf)
> if (sscanf(line, "%"SCNu64" %*d %d:%d", &mnt_id, &line_mjr, &line_mnr) != 3)
> continue;
>
> - if (line_mjr == buf->stx_dev_major && line_mnr == buf->stx_dev_minor)
> + if (line_mjr == buf->stx_dev_major && line_mnr == buf->stx_dev_minor &&
> + mnt_id == buf->stx_mnt_id)
The fail message after this point doesn't make sense with this change.
if (buf->stx_mnt_id == mnt_id)
tst_res(TPASS,
"statx.stx_mnt_id equals to mount_id(%"PRIu64") in /proc/self/mountinfo",
mnt_id);
else
tst_res(TFAIL,
"statx.stx_mnt_id(%"PRIu64") is different from mount_id(%"PRIu64") in /proc/self/mountinfo",
(uint64_t)buf->stx_mnt_id, mnt_id);
It'll print whatever the last mnt_id is which is probably unrelated.
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] syscalls/statx01: Add exit condition when parsing /proc/self/mountinfo
2022-12-12 15:20 ` Richard Palethorpe
@ 2022-12-13 1:51 ` xuyang2018.jy
0 siblings, 0 replies; 3+ messages in thread
From: xuyang2018.jy @ 2022-12-13 1:51 UTC (permalink / raw)
To: rpalethorpe@suse.de; +Cc: ltp@lists.linux.it
Hi Richard
> Hello,
>
> Yang Xu <xuyang2018.jy@fujitsu.com> writes:
>
>> When using user filesystem such as overlayfs, the current parsing way can't
>> work well.
>>
>> 63 66 8:3 / /sysroot rw,relatime - ext4 /dev/sda3 rw,seclabel
>> 43 66 8:3 /ostree/deploy/rhivos/var /var rw,relatime shared:3 - ext4 /dev/sda3 rw,seclabel
>>
>> So add the exit condition for statx.mnt_id check so it can skip the
>> underflying filesystem and parse the correct user fileystem's mnt_id.
>>
>> Fixes: #1001
>> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
>> ---
>> testcases/kernel/syscalls/statx/statx01.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
>> index 60b50958b..931aa60c1 100644
>> --- a/testcases/kernel/syscalls/statx/statx01.c
>> +++ b/testcases/kernel/syscalls/statx/statx01.c
>> @@ -68,7 +68,8 @@ static void test_mnt_id(struct statx *buf)
>> if (sscanf(line, "%"SCNu64" %*d %d:%d", &mnt_id, &line_mjr, &line_mnr) != 3)
>> continue;
>>
>> - if (line_mjr == buf->stx_dev_major && line_mnr == buf->stx_dev_minor)
>> + if (line_mjr == buf->stx_dev_major && line_mnr == buf->stx_dev_minor &&
>> + mnt_id == buf->stx_mnt_id)
>
> The fail message after this point doesn't make sense with this change.
>
> if (buf->stx_mnt_id == mnt_id)
> tst_res(TPASS,
> "statx.stx_mnt_id equals to mount_id(%"PRIu64") in /proc/self/mountinfo",
> mnt_id);
> else
> tst_res(TFAIL,
> "statx.stx_mnt_id(%"PRIu64") is different from mount_id(%"PRIu64") in /proc/self/mountinfo",
> (uint64_t)buf->stx_mnt_id, mnt_id);
>
> It'll print whatever the last mnt_id is which is probably unrelated.
Good catch, will send v2.
Best Regards
Yang Xu
>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-13 1:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-07 10:36 [LTP] [PATCH] syscalls/statx01: Add exit condition when parsing /proc/self/mountinfo Yang Xu
2022-12-12 15:20 ` Richard Palethorpe
2022-12-13 1:51 ` xuyang2018.jy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.