generic/459: catch mount failure
authorDave Chinner <dchinner@redhat.com>
Fri, 9 Jul 2021 06:10:27 +0000 (16:10 +1000)
committerEryu Guan <guaneryu@gmail.com>
Sun, 18 Jul 2021 13:52:45 +0000 (21:52 +0800)
Because if we don't, we freeze the root filesystem instead of
$SCRATCH_MNT and it all goes downhill from there.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/459

index 7fd7a6f..e5e5e9a 100755 (executable)
@@ -77,7 +77,9 @@ _mkfs_dev /dev/mapper/$vgname-$lvname >>$seqres.full 2>&1
 $LVM_PROG lvcreate  -k n -s $vgname/$lvname \
                    -n $snapname >>$seqres.full 2>&1
 
-_mount /dev/mapper/$vgname-$snapname $SCRATCH_MNT
+# Catch mount failure so we don't blindly go an freeze the root filesystem
+# instead of lvm volume.
+_mount /dev/mapper/$vgname-$snapname $SCRATCH_MNT || _fail "mount failed"
 
 # Consume all space available in the volume and freeze to ensure everything
 # required to make the fs consistent is flushed to disk.