[PATCH 12/14] generic/204: break out of fs-filling loop early if we ENOSPC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

If filling up the filesystem causes us to hit ENOSPC earlier than we
thought we would (the sizing estimates become less and less accurate as
we add more metadata) then just bail out -- we're checking that the fs
is robust enough to cut us off before we actually run out of space for
writing metadata and crash the fs.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 tests/generic/204 |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)


diff --git a/tests/generic/204 b/tests/generic/204
index 4c203a2..1e2c1e1 100755
--- a/tests/generic/204
+++ b/tests/generic/204
@@ -82,8 +82,15 @@ echo files $files, resvblks $resv_blks >> $seqres.full
 _scratch_resvblks $resv_blks >> $seqres.full 2>&1
 
 for i in `seq 1 $files`; do
-    echo -n > $SCRATCH_MNT/$i
-    echo XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX > $SCRATCH_MNT/$i
+	# Open/truncate file, write stuff.  If we run out of space early,
+	# we can bail out of the loop.
+	out="$($XFS_IO_PROG \
+		-c "open -f -t $SCRATCH_MNT/$i" \
+		-c 'close' \
+		-c "open -f -t $SCRATCH_MNT/$i" \
+		-c 'pwrite -q -S 0x58 0 36' 2>&1 | _filter_scratch)"
+	echo "${out}" | grep -q 'No space left on device' && break
+	test -n "${out}" && echo "${out}"
 done
 
 # success, all done

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux