From: "Darrick J. Wong" <djwong@xxxxxxxxxx> Fix this function to call _notrun whenever something fails. If we can't figure out the atomic write geometry, then we haven't satisfied the preconditions for the test. Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> Signed-off-by: Catherine Hoang <catherine.hoang@xxxxxxxxxx> --- common/atomicwrites | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/common/atomicwrites b/common/atomicwrites index 9ec1ca68..391bb6f6 100644 --- a/common/atomicwrites +++ b/common/atomicwrites @@ -28,21 +28,23 @@ _require_scratch_write_atomic() { _require_scratch - awu_min_bdev=$(_get_atomic_write_unit_min $SCRATCH_DEV) - awu_max_bdev=$(_get_atomic_write_unit_max $SCRATCH_DEV) + local awu_min_bdev=$(_get_atomic_write_unit_min $SCRATCH_DEV) + local awu_max_bdev=$(_get_atomic_write_unit_max $SCRATCH_DEV) if [ $awu_min_bdev -eq 0 ] && [ $awu_max_bdev -eq 0 ]; then _notrun "write atomic not supported by this block device" fi - _scratch_mkfs > /dev/null 2>&1 - _scratch_mount + _scratch_mkfs > /dev/null 2>&1 || \ + _notrun "cannot format scratch device for atomic write checks" + _try_scratch_mount || \ + _notrun "cannot mount scratch device for atomic write checks" - testfile=$SCRATCH_MNT/testfile + local testfile=$SCRATCH_MNT/testfile touch $testfile - awu_min_fs=$(_get_atomic_write_unit_min $testfile) - awu_max_fs=$(_get_atomic_write_unit_max $testfile) + local awu_min_fs=$(_get_atomic_write_unit_min $testfile) + local awu_max_fs=$(_get_atomic_write_unit_max $testfile) _scratch_unmount -- 2.34.1