From patchwork Mon Mar 21 07:23:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 8629891 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7B2C3C0554 for ; Mon, 21 Mar 2016 07:24:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 92EDC20272 for ; Mon, 21 Mar 2016 07:24:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9975E20270 for ; Mon, 21 Mar 2016 07:24:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752747AbcCUHYX (ORCPT ); Mon, 21 Mar 2016 03:24:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47600 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752124AbcCUHYW (ORCPT ); Mon, 21 Mar 2016 03:24:22 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id A57568EA38; Mon, 21 Mar 2016 07:24:21 +0000 (UTC) Received: from localhost (dhcp12-128.nay.redhat.com [10.66.12.128] (may be forged)) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2L7OKtK000921; Mon, 21 Mar 2016 03:24:21 -0400 From: Eryu Guan To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org, Eryu Guan Subject: [PATCH] fstests: _fail the tests if _scratch_mount failed to avoid fully filling root fs Date: Mon, 21 Mar 2016 15:23:41 +0800 Message-Id: <1458545021-23285-1-git-send-email-eguan@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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(-) 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