From patchwork Sat Mar 10 23:56:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 10274471 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 F39B060211 for ; Sun, 11 Mar 2018 01:09:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D501A29122 for ; Sun, 11 Mar 2018 01:09:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B4BE9291DE; Sun, 11 Mar 2018 01:09:10 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY 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 D73CB29122 for ; Sun, 11 Mar 2018 01:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751191AbeCKBJH (ORCPT ); Sat, 10 Mar 2018 20:09:07 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:47388 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751135AbeCKBJG (ORCPT ); Sat, 10 Mar 2018 20:09:06 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2B12iPK122444; Sun, 11 Mar 2018 01:09:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=9XoDPVlfmIVNL+g9yxTxQSjZ24CDlrU4uEKaOfJSWcw=; b=fJWYFLb7BHN8v1QBUhwjEuak/sKF9krXIxBL1XFQsu0BjENAiM+cfY2HD73lpHc0Nqd1 QmxI/XTKfb6GEIQno2Bu/uPzlo2jPlGK/0Na/gmsIHry1q3Hx2CsvJYubP59Z+VgqJHr Tri7/SnrjRRilTZC4VqPEKZoqjtt/GPdEtlp1v0mQa7QNHkaXabkc2Cg2lzhNmWfvPYm NBAghV6gxRlrgiomLh48KCe4Vci2wXjvDyuGO56cFQCZaZEe3/Wp5AIEA5hqc+UnXKjD tDSAliZWJVvpSb/G4KsRb0BkzNAOeJDhWK50ybAF35E5n0v6g98r6WupzLxsUS/DQe5O AQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2gmrxkr4g0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 11 Mar 2018 01:09:05 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2B0x48F019708 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 11 Mar 2018 00:59:05 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w2B0x4pl028635; Sun, 11 Mar 2018 00:59:04 GMT Received: from dhcp-10-211-47-181.usdhcp.oraclecorp.com.com (/10.211.47.181) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 10 Mar 2018 16:59:04 -0800 From: Liu Bo To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org Subject: [PATCH v2] fstests: test regression of -EEXIST on creating new file after log replay Date: Sat, 10 Mar 2018 16:56:04 -0700 Message-Id: <20180310235604.3206-1-bo.li.liu@oracle.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20180307235910.12313-1-bo.li.liu@oracle.com> References: <20180307235910.12313-1-bo.li.liu@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8828 signatures=668690 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=52 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=653 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803110013 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The regression is introduced to btrfs in linux v4.4 and it refuses to create new files after log replay by returning -EEXIST. Although the problem is on btrfs only, there is no btrfs stuff in terms of test, so this makes it generic. The kernel fix is Btrfs: fix unexpected -EEXIST when creating new inode Reviewed-by: Filipe Manana Signed-off-by: Liu Bo --- v2: - Remove failed message from 481.out - Drop the unnecessary write in creating a file tests/generic/481 | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/481.out | 2 ++ tests/generic/group | 1 + 3 files changed, 78 insertions(+) create mode 100755 tests/generic/481 create mode 100644 tests/generic/481.out diff --git a/tests/generic/481 b/tests/generic/481 new file mode 100755 index 0000000..6a7e9dd --- /dev/null +++ b/tests/generic/481 @@ -0,0 +1,75 @@ +#! /bin/bash +# FSQA Test No. 481 +# +# Reproduce a regression of btrfs that leads to -EEXIST on creating new files +# after log replay. +# +# The kernel fix is +# Btrfs: fix unexpected -EEXIST when creating new inode +# +#----------------------------------------------------------------------- +# +# Copyright (C) 2018 Oracle. All Rights Reserved. +# Author: Bo Liu +# +# 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" +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + _cleanup_flakey + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/dmflakey + +# real QA test starts here +_supported_fs generic +_supported_os Linux +_require_scratch +_require_dm_target flakey + +rm -f $seqres.full + +_scratch_mkfs >>$seqres.full 2>&1 +_init_flakey +_mount_flakey + +# create a file and keep it in write ahead log +$XFS_IO_PROG -f -c "fsync" $SCRATCH_MNT/foo + +# fail this filesystem so that remount can replay the write ahead log +_flakey_drop_and_remount + +# see if we can create a new file successfully +touch $SCRATCH_MNT/bar + +_unmount_flakey + +echo "Silence is golden" + +status=0 +exit diff --git a/tests/generic/481.out b/tests/generic/481.out new file mode 100644 index 0000000..206e116 --- /dev/null +++ b/tests/generic/481.out @@ -0,0 +1,2 @@ +QA output created by 481 +Silence is golden diff --git a/tests/generic/group b/tests/generic/group index ea2056b..05f60f2 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -483,3 +483,4 @@ 478 auto quick 479 auto quick metadata 480 auto quick metadata +481 auto quick