From patchwork Tue Oct 23 18:16:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Foster X-Patchwork-Id: 10653463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A1F4814BB for ; Tue, 23 Oct 2018 18:16:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C6B52A2B4 for ; Tue, 23 Oct 2018 18:16:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 77F8D2A2C3; Tue, 23 Oct 2018 18:16:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 154C82A2AB for ; Tue, 23 Oct 2018 18:16:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728052AbeJXClI (ORCPT ); Tue, 23 Oct 2018 22:41:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41684 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725997AbeJXClI (ORCPT ); Tue, 23 Oct 2018 22:41:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6C09A356DA; Tue, 23 Oct 2018 18:16:39 +0000 (UTC) Received: from bfoster.bos.redhat.com (dhcp-41-2.bos.redhat.com [10.18.41.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07DAE65F61; Tue, 23 Oct 2018 18:16:38 +0000 (UTC) From: Brian Foster To: linux-xfs@vger.kernel.org Cc: fstests@vger.kernel.org Subject: [PATCH] tests/xfs: writepage map error unmount test Date: Tue, 23 Oct 2018 14:16:38 -0400 Message-Id: <20181023181638.43407-1-bfoster@redhat.com> In-Reply-To: <20181023181543.43315-1-bfoster@redhat.com> References: <20181023181543.43315-1-bfoster@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 23 Oct 2018 18:16:39 +0000 (UTC) Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Certain failures in the page writeback codepath can cause a broader writeback (i.e., a sync) sequence to exit prematurely. If this occurs during an unmount, it's likely the filesystem will reclaim inodes without having cleared all delayed allocation blocks. This produces a warning and leaves the filesystem inconsistent. This test reproduces this scenario using the 'writepage_map' errortag. It performs delayed allocation, injects writeback errors and immediately unmounts the filesystem. Signed-off-by: Brian Foster --- Note that this depends on a not yet available error tag. Brian tests/xfs/494 | 57 +++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/494.out | 2 ++ tests/xfs/group | 1 + 3 files changed, 60 insertions(+) create mode 100755 tests/xfs/494 create mode 100644 tests/xfs/494.out diff --git a/tests/xfs/494 b/tests/xfs/494 new file mode 100755 index 00000000..30877d38 --- /dev/null +++ b/tests/xfs/494 @@ -0,0 +1,57 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Red Hat, Inc. All Rights Reserved. +# +# FS QA Test 494 +# +# Simulate a serialization problem between page writeback error handling and +# unmount. If ->writepages() fails and returns an error back to the mm +# subsystem, writeback of subsequent pages is interrupted and the filesystem +# unmounts before processing all dirty pages. This results in unmounting a +# filesystem with dirty+delalloc pages, which in turn causes unmount time +# warnings and filesystem inconsistency. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/inject + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_error_injection +_require_xfs_io_error_injection "writepage_map" +_require_scratch + +_scratch_mkfs >> $seqres.full 2>&1 + +_scratch_mount +_scratch_inject_error "writepage_map" 1 +# use 512k to dirty multiple pages on large page size systems +$XFS_IO_PROG -fc "pwrite 0 512k" $SCRATCH_MNT/file >> $seqres.full 2>&1 +_scratch_unmount + +echo Silence is golden + +# success, all done +status=0 +exit diff --git a/tests/xfs/494.out b/tests/xfs/494.out new file mode 100644 index 00000000..827c239a --- /dev/null +++ b/tests/xfs/494.out @@ -0,0 +1,2 @@ +QA output created by 494 +Silence is golden diff --git a/tests/xfs/group b/tests/xfs/group index 2cec0585..136d3707 100644 --- a/tests/xfs/group +++ b/tests/xfs/group @@ -491,3 +491,4 @@ 491 auto quick fuzz 492 auto quick fuzz 493 auto quick fuzz +494 auto quick