From patchwork Wed May 9 12:58:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lu Fengqi X-Patchwork-Id: 10389363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2241060153 for ; Wed, 9 May 2018 12:58:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11FC428F90 for ; Wed, 9 May 2018 12:58:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 064E528FA7; Wed, 9 May 2018 12:58:35 +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 6519428F8E for ; Wed, 9 May 2018 12:58:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934798AbeEIM6d (ORCPT ); Wed, 9 May 2018 08:58:33 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:10718 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934638AbeEIM6a (ORCPT ); Wed, 9 May 2018 08:58:30 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="39735160" Received: from bogon (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 09 May 2018 20:58:27 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 277E64B34D23; Wed, 9 May 2018 20:58:24 +0800 (CST) Received: from [192.168.1.2] (10.167.226.155) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 9 May 2018 20:58:26 +0800 Subject: Re: [PATCH] btrfs: add test for seeing unseen fsync errors on newly open files To: Jeff Layton , CC: , , , , References: <20180508125657.10045-1-jlayton@kernel.org> From: Lu Fengqi Message-ID: Date: Wed, 9 May 2018 20:58:20 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180508125657.10045-1-jlayton@kernel.org> Content-Language: en-US X-Originating-IP: [10.167.226.155] X-yoursite-MailScanner-ID: 277E64B34D23.A85F3 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: lufq.fnst@cn.fujitsu.com Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 05/08/2018 08:56 PM, Jeff Layton wrote: > From: Jeff Layton > > This adds a regression test for the following kernel patch: > > errseq: Always report a writeback error once > > This is motivated by some rather odd behavior done by the PostgreSQL > project. The main database writers will offload the fsync calls to a > separate process, which can open files after a writeback error has > already occurred. > > This used to work with older kernels that reported the error to only > one fd, but with the errseq_t changes we lost the ability to see > errors that occurred before the open. The above patch restores that > behavior. > > Signed-off-by: Jeff Layton > --- > tests/btrfs/999 | 110 ++++++++++++++++++++++++++++++++++++++++++++ > tests/btrfs/999.out | 5 ++ > tests/btrfs/group | 1 + > 3 files changed, 116 insertions(+) > create mode 100755 tests/btrfs/999 > create mode 100644 tests/btrfs/999.out > > diff --git a/tests/btrfs/999 b/tests/btrfs/999 > new file mode 100755 > index 000000000000..0f68942a91da > --- /dev/null > +++ b/tests/btrfs/999 > @@ -0,0 +1,110 @@ > +#! /bin/bash > +# FS QA Test No. 999 > +# > +# Open a file and write to it and fsync. Then flip the data device to throw > +# errors, write to it again and call sync. Close the file, reopen it and > +# then call fsync on it. Is the error reported? > +# > +#----------------------------------------------------------------------- > +# Copyright (c) 2018, Jeff Layton > +# > +# This program is free software; you can redistribute it and/or > +# modify it under the terms of the GNU General Public License as > +# published by the Free Software Foundation. > +# > +# This program is distributed in the hope that it would be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program; if not, write the Free Software Foundation, > +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA > +#----------------------------------------------------------------------- > + > +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 -rf $tmp.* $testdir > + _dmerror_cleanup > +} > + > +# get standard environment, filters and checks > +. ./common/rc > +. ./common/filter > +. ./common/dmerror > + > +# real QA test starts here > +_supported_os Linux > +_supported_fs btrfs > +# This test uses "dm" without taking into account the data could be on > +# realtime subvolume, thus the test will fail with rtinherit=1 > +_require_no_rtinherit > +_require_scratch_dev_pool > + > +_require_dm_target error > + > +rm -f $seqres.full > + > +# bring up dmerror device > +_scratch_unmount # diff -u tests/btrfs/999.out results/btrfs/999.out.bad The above _require_scratch_dev_pool has already umounted the scratch. --- tests/btrfs/999.out 2018-05-09 13:01:21.605173303 +0800 +++ results/btrfs/999.out.bad 2018-05-09 20:50:46.721383569 +0800 @@ -1,4 +1,5 @@ QA output created by 999 +umount: /mnt/scratch: not mounted. Format and mount The following fsync should fail with EIO: fsync: Input/output error