Linux filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Baokun Li <libaokun@linux.alibaba.com>
Cc: fstests@vger.kernel.org, zlang@kernel.org,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
	sandeen@redhat.com, dgc@kernel.org
Subject: Re: [PATCH] generic/492: bypass the blkid cache when probing the label
Date: Sun, 20 Sep 2026 22:27:19 -0700	[thread overview]
Message-ID: <20260921052719.GB6253@frogsfrogsfrogs> (raw)
In-Reply-To: <20260920094137.2749428-1-libaokun@linux.alibaba.com>

On Sun, Sep 20, 2026 at 05:41:37PM +0800, Baokun Li wrote:
> blkid may serve a stale label from its cache instead of probing the
> device, so the label just set via xfs_io can be missed and the output
> mismatch is non-deterministic.
> 
> Pass "-c /dev/null" so that blkid always probes the on-disk superblock
> directly.  Unlike the low-level probing mode (-p), which requires
> util-linux 2.16 or later, this is also supported by the legacy blkid
> shipped with e2fsprogs.
> 
> Fixes: c3c9630968a6 ("generic: test online label ioctl")
> Signed-off-by: Baokun Li <libaokun@linux.alibaba.com>

Seems fine to me; I guess blkid could be racing with whatever updates
the cache...udev?

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  tests/generic/492 | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/generic/492 b/tests/generic/492
> index 51a46b510453..0b4f69b80f17 100755
> --- a/tests/generic/492
> +++ b/tests/generic/492
> @@ -28,14 +28,15 @@ $XFS_IO_PROG -c "label -c" $SCRATCH_MNT
>  $XFS_IO_PROG -c "label" $SCRATCH_MNT
>  
>  # And that userspace can see it now, while mounted
> -# NB: some blkid has trailing whitespace, filter it out here
> +# NB: bypass the blkid cache which may hold a stale label, and filter
> +# out the trailing whitespace some blkid versions emit
>  $XFS_IO_PROG -c "label -s label.$seq" $SCRATCH_MNT
>  $XFS_IO_PROG -c "label" $SCRATCH_MNT
> -blkid -s LABEL $SCRATCH_DEV | _filter_scratch | sed -e "s/ $//g"
> +blkid -c /dev/null -s LABEL $SCRATCH_DEV | _filter_scratch | sed -e "s/ $//g"
>  
>  # And that the it is still there when it's unmounted
>  _scratch_unmount
> -blkid -s LABEL $SCRATCH_DEV | _filter_scratch | sed -e "s/ $//g"
> +blkid -c /dev/null -s LABEL $SCRATCH_DEV | _filter_scratch | sed -e "s/ $//g"
>  
>  # And that it persists after a remount
>  _scratch_mount
> -- 
> 2.43.7
> 
> 

  reply	other threads:[~2026-09-21  5:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  9:41 [PATCH] generic/492: bypass the blkid cache when probing the label Baokun Li
2026-09-21  5:27 ` Darrick J. Wong [this message]
2026-09-21  9:07   ` Baokun Li
2026-09-21 23:49     ` Darrick J. Wong
2026-09-22  3:43       ` Theodore Tso
2026-09-22  7:17         ` Baokun Li
2026-09-22 14:53           ` Darrick J. Wong
2026-09-23  9:13             ` Baokun Li
2026-09-22 15:56           ` Theodore Tso
2026-09-23 10:02             ` Baokun Li
2026-09-24  2:25               ` Theodore Tso
2026-09-24  8:09                 ` Baokun Li

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=20260921052719.GB6253@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=dgc@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=libaokun@linux.alibaba.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --cc=zlang@kernel.org \
    /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