On Sun 10-11-19 22:10:54, Eryu Guan wrote: > [cc'ed Darrick for his inputs, if there's any] > > fi > > _link_out_file "$features" > > > > _scratch_mkfs >/dev/null 2>&1 > > > > -filter_ro_mount() { > > - local arg="" > > - > > - if [ -n "$expect_mount_failure" ]; then > > - arg="s|mount: $SCRATCH_MNT: permission denied|mount: device write-protected, mounting read-only|g" > > - fi > > - sed -e "$arg" | _filter_ro_mount > > -} > > - > > -# Mounting with quota on XFS requires a writable fs, which means > > -# we expect to fail the ro blockdev test with with EPERM. > > -expect_mount_failure= > > -if [ "$FSTYP" = "xfs" ] && echo "$MOUNT_OPTIONS" | grep -q quota ; then > > - expect_mount_failure=1 > > -fi > > - > > # > > # Mark the device read-only > > # > > @@ -70,7 +58,7 @@ blockdev --setro $SCRATCH_DEV > > # Mount it, and make sure we can't write to it, and we can unmount it again > > # > > echo "mounting read-only block device:" > > -_try_scratch_mount 2>&1 | filter_ro_mount > > +_try_scratch_mount 2>&1 | _filter_ro_mount > > if [ "${PIPESTATUS[0]}" -eq 0 ]; then > > But I think we could remove above check as a whole, just do > > _try_scratch_mount 2>&1 | _filter_ro_mount > echo "touching file on read-only filesystem (should fail)" > touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch > echo "unmounting read-only filesystem" > _scratch_unmount 2>&1 | _filter_scratch > > as what we did prior to commit b0415daaa968 ("generic/050: fix ro > blockdev mount of xfs with quota"). Your suggestion looks good to me. I'll update the patch, test, and resend. Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR