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 --- 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