diff mbox

fstests: _fail the tests if _scratch_mount failed to avoid fully filling root fs

Message ID 1458545021-23285-1-git-send-email-eguan@redhat.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Eryu Guan March 21, 2016, 7:23 a.m. UTC
btrfs failed to mount small fs on ppc64 host with error ENOSPC, even
creating such small fs succeeded, then generic/027 consumed all free
space on root fs not on SCRATCH_DEV and test harness cannot create tmp
files and continue other tests.

Though I think it's a btrfs bug, it's still worth preventing this
situation from happening in the harness, as such tests usually aim to
exercise fs on ENOSPC conditions, there's no point to continue if the
small fs is not mounted.

So I went through all tests that call _scratch_mkfs_sized && could
consume all free space on $SCRATCH_MNT, _fail the test if _scratch_mount
failed.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 tests/generic/027 | 2 +-
 tests/generic/269 | 2 +-
 tests/generic/270 | 2 +-
 tests/generic/274 | 2 +-
 tests/generic/275 | 2 +-
 tests/generic/300 | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

Comments

Dave Chinner March 23, 2016, 12:08 a.m. UTC | #1
On Mon, Mar 21, 2016 at 03:23:41PM +0800, Eryu Guan wrote:
> btrfs failed to mount small fs on ppc64 host with error ENOSPC, even
> creating such small fs succeeded, then generic/027 consumed all free
> space on root fs not on SCRATCH_DEV and test harness cannot create tmp
> files and continue other tests.
> 
> Though I think it's a btrfs bug, it's still worth preventing this
> situation from happening in the harness, as such tests usually aim to
> exercise fs on ENOSPC conditions, there's no point to continue if the
> small fs is not mounted.

I think the btrfs bug should be fixed. At minimum, the workaround to
see if the filesytem can be mounted should be in btrfs's
implementation of scratch_mkfs_sized....

Cheers,

Dave.
Eryu Guan March 23, 2016, 3:23 a.m. UTC | #2
On Wed, Mar 23, 2016 at 11:08:56AM +1100, Dave Chinner wrote:
> On Mon, Mar 21, 2016 at 03:23:41PM +0800, Eryu Guan wrote:
> > btrfs failed to mount small fs on ppc64 host with error ENOSPC, even
> > creating such small fs succeeded, then generic/027 consumed all free
> > space on root fs not on SCRATCH_DEV and test harness cannot create tmp
> > files and continue other tests.
> > 
> > Though I think it's a btrfs bug, it's still worth preventing this
> > situation from happening in the harness, as such tests usually aim to
> > exercise fs on ENOSPC conditions, there's no point to continue if the
> > small fs is not mounted.
> 
> I think the btrfs bug should be fixed. At minimum, the workaround to
> see if the filesytem can be mounted should be in btrfs's
> implementation of scratch_mkfs_sized....

OK, I'll add workaround in _scratch_mkfs_sized. Thanks for reviewing!

Eryu
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eryu Guan March 23, 2016, 7:38 a.m. UTC | #3
On Wed, Mar 23, 2016 at 11:23:29AM +0800, Eryu Guan wrote:
> On Wed, Mar 23, 2016 at 11:08:56AM +1100, Dave Chinner wrote:
> > On Mon, Mar 21, 2016 at 03:23:41PM +0800, Eryu Guan wrote:
> > > btrfs failed to mount small fs on ppc64 host with error ENOSPC, even
> > > creating such small fs succeeded, then generic/027 consumed all free
> > > space on root fs not on SCRATCH_DEV and test harness cannot create tmp
> > > files and continue other tests.
> > > 
> > > Though I think it's a btrfs bug, it's still worth preventing this
> > > situation from happening in the harness, as such tests usually aim to
> > > exercise fs on ENOSPC conditions, there's no point to continue if the
> > > small fs is not mounted.
> > 
> > I think the btrfs bug should be fixed. At minimum, the workaround to
> > see if the filesytem can be mounted should be in btrfs's
> > implementation of scratch_mkfs_sized....
> 
> OK, I'll add workaround in _scratch_mkfs_sized. Thanks for reviewing!

I think about it another time, I agree that what really should be fixed
is the btrfs bug, not fstests. I'll drop this patch and report bug to
btrfs list.

Thanks,
Eryu
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tests/generic/027 b/tests/generic/027
index d2e59d6..e5fdbe9 100755
--- a/tests/generic/027
+++ b/tests/generic/027
@@ -66,7 +66,7 @@  rm -f $seqres.full
 echo "Silence is golden"
 
 _scratch_mkfs_sized $((256 * 1024 * 1024)) >>$seqres.full 2>&1
-_scratch_mount
+_scratch_mount || _fail "mount failed"
 
 echo "Reserve 2M space" >>$seqres.full
 $XFS_IO_PROG -f -c "pwrite 0 2m" $SCRATCH_MNT/testfile >>$seqres.full 2>&1
diff --git a/tests/generic/269 b/tests/generic/269
index ee353a5..adc766f 100755
--- a/tests/generic/269
+++ b/tests/generic/269
@@ -68,7 +68,7 @@  _require_scratch
 
 rm -f $seqres.full
 _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full 2>&1
-_scratch_mount
+_scratch_mount || _fail "mount failed"
 
 if ! _workout; then
 	_scratch_unmount 2>/dev/null
diff --git a/tests/generic/270 b/tests/generic/270
index e6874c9..b0164be 100755
--- a/tests/generic/270
+++ b/tests/generic/270
@@ -82,7 +82,7 @@  _require_scratch
 
 rm -f $seqres.full
 _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full 2>&1
-_scratch_mount "-o usrquota,grpquota"
+_scratch_mount "-o usrquota,grpquota" || _fail "mount failed"
 chmod 777 $SCRATCH_MNT
 quotacheck -u -g $SCRATCH_MNT 2>/dev/null
 quotaon -u -g $SCRATCH_MNT 2>/dev/null
diff --git a/tests/generic/274 b/tests/generic/274
index 61ab220..7feca5c 100755
--- a/tests/generic/274
+++ b/tests/generic/274
@@ -58,7 +58,7 @@  rm -f $seqres.full
 
 _scratch_unmount 2>/dev/null
 _scratch_mkfs_sized $((2 * 1024 * 1024 * 1024)) >>$seqres.full 2>&1
-_scratch_mount
+_scratch_mount || _fail "mount failed"
 
 # Create a 4k file and Allocate 4M past EOF on that file
 $XFS_IO_PROG -f -c "pwrite 0 4k" -c "falloc -k 4k 4m" $SCRATCH_MNT/test \
diff --git a/tests/generic/275 b/tests/generic/275
index 955c4ac..3e5940a 100755
--- a/tests/generic/275
+++ b/tests/generic/275
@@ -55,7 +55,7 @@  rm -f $seqres.full
 
 _scratch_unmount 2>/dev/null
 _scratch_mkfs_sized $((2 * 1024 * 1024 * 1024)) >>$seqres.full 2>&1
-_scratch_mount
+_scratch_mount || _fail "mount failed"
 
 # this file will get removed to create 256k of free space after ENOSPC
 # conditions are created.
diff --git a/tests/generic/300 b/tests/generic/300
index c187f43..0b2463d 100755
--- a/tests/generic/300
+++ b/tests/generic/300
@@ -143,7 +143,7 @@  _workout()
 _require_fio $fio_config
 
 _scratch_mkfs_sized $FS_SIZE >> $seqres.full 2>&1
-_scratch_mount
+_scratch_mount || _fail "mount failed"
 
 if ! _workout; then
 	_scratch_unmount 2>/dev/null