Skip to contentSkip to conversation

ext4/271: improve mkfs and mount error handling

PATCH New Eric Whitney 1 participant 1 message Oct 2, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4/271: improve mkfs and mount error handling

If 271's attempt to make a scratch device fails, it can inadvertently mount and run on a pre-existing scratch file system. This can lead to invalid test results unless the mkfs failure is separately noted in 271.full.

Noted while debugging an ext4 inline data test failure. Small ext4 file systems, as used by this test, use small inodes that are incompatible with inline data.

---
 tests/ext4/271 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tests/ext4/271 +5 -2
index e77ae57..44d9147 100755
@@ -41,11 +41,14 @@ _supported_os Linux
 _need_to_be_root
 _require_scratch
 
-_scratch_mkfs_sized $((128 * 1024 * 1024)) >> $seqres.full 2>&1
+rm -f $seqres.full
+
+_scratch_mkfs_sized $((128 * 1024 * 1024)) >> $seqres.full 2>&1 \
+	|| _fail "mkfs failed"
 
 # -onoload and EXT4_SYNC_FL on file is important becase result in
 # metadata sync writes inside ext4_handle_dirty_metadata()
-_scratch_mount -onoload
+_scratch_mount -onoload >> $seqres.full 2>&1 || _fail "mount failed"
 touch $SCRATCH_MNT/file
 chattr +S $SCRATCH_MNT/file
 # Create sparse file 
Signature · 1 line
1.9.1