Linux Test Project
 help / color / mirror / Atom feed
From: Richard Palethorpe <rpalethorpe@suse.de>
To: Yang Xu <xuyang2018.jy@fujitsu.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] syscalls/statx01: Add exit condition when parsing /proc/self/mountinfo
Date: Tue, 13 Dec 2022 10:59:17 +0000	[thread overview]
Message-ID: <87y1rbr2e9.fsf@suse.de> (raw)
In-Reply-To: <1670901258-1995-1-git-send-email-xuyang2018.jy@fujitsu.com>

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>
> ---
> v1-v2: change the fail message
>  testcases/kernel/syscalls/statx/statx01.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/statx/statx01.c b/testcases/kernel/syscalls/statx/statx01.c
> index 60b50958b..e9677475a 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;
>  	}
>  
> @@ -80,8 +81,8 @@ static void test_mnt_id(struct statx *buf)
>  			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);
> +			"statx.stx_mnt_id(%"PRIu64") doesn't exist in /proc/self/mountinfo",
> +			(uint64_t)buf->stx_mnt_id);

The mnt_id may exist in mountinfo, but not the triple (mnt_id,
dev_major, dev_minor). So really we should print all three here (unless
we already display that somewhere else).

>  
>  	pid = getpid();
>  	snprintf(line, PATH_MAX, "/proc/%d/fdinfo/%d", pid, file_fd);
> -- 
> 2.27.0


-- 
Thank you,
Richard.

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

  reply	other threads:[~2022-12-13 11:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13  3:14 [LTP] [PATCH v2] syscalls/statx01: Add exit condition when parsing /proc/self/mountinfo Yang Xu
2022-12-13 10:59 ` Richard Palethorpe [this message]
2022-12-15  7:14   ` xuyang2018.jy
2022-12-15  9:58     ` Richard Palethorpe
2022-12-16  2:05       ` xuyang2018.jy

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=87y1rbr2e9.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