From patchwork Wed Mar 7 23:59:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 10265725 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 2072060247 for ; Thu, 8 Mar 2018 01:02:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11A7328E1A for ; Thu, 8 Mar 2018 01:02:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0672529198; Thu, 8 Mar 2018 01:02:44 +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=unavailable 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 9AB3B28E1A for ; Thu, 8 Mar 2018 01:02:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754875AbeCHBCk (ORCPT ); Wed, 7 Mar 2018 20:02:40 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:53242 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754771AbeCHBCj (ORCPT ); Wed, 7 Mar 2018 20:02:39 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2812Lfd066348; Thu, 8 Mar 2018 01:02:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2017-10-26; bh=ym0TMnG10cWq3yOlOPNVfoDMvAeD/2MgKOiPPHlWhIM=; b=TjON+qFdSqMtGsN1yE8Z3XqEiZud+PkGdVt7MZu/r4nWJYE5ovNZN4U1yWr7S5nqU+CA lHGM91u0pIrcaR6G3cMrSVpJa3xKs5ZUFfFiBFESzdfVkqJZlxZOTjHEB+N3ng2Q6xQp qQRePn+dtHwaUV3FkkmzvEohdhdx46QJKhhVcQ382Ibf9J3jSgVpRK854zINUSaZYFBy ZrBTqsyMIgRXwpRA0B6DFG/rsuciPQjd1+77GX8v7p4l2zitDBWympLF8qUxXTKHWZj6 xkv8Pecyj6ONboichnUcmuucxqlzxJ9QyNvQTZu8W3aQ4M3zQCYi2DFwuxc8TDPpE78Y OQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2gju29r1f2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Mar 2018 01:02:38 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w2812biT026948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Mar 2018 01:02:37 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w2812aXi003518; Thu, 8 Mar 2018 01:02:36 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 ; Wed, 07 Mar 2018 17:02:36 -0800 From: Liu Bo To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org Subject: [PATCH] fstests: test regression of -EEXIST on creating new file after log replay Date: Wed, 7 Mar 2018 16:59:10 -0700 Message-Id: <20180307235910.12313-1-bo.li.liu@oracle.com> X-Mailer: git-send-email 2.9.4 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8825 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=52 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=672 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803080010 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@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 Signed-off-by: Liu Bo Reviewed-by: Filipe Manana --- tests/generic/481 | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/generic/481.out | 5 ++++ tests/generic/group | 1 + 3 files changed, 81 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..8d8bb2b --- /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 "pwrite 0 4k" -c "fsync" $SCRATCH_MNT/foo | _filter_xfs_io + +# 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..66a6345 --- /dev/null +++ b/tests/generic/481.out @@ -0,0 +1,5 @@ +QA output created by 481 +wrote 4096/4096 bytes at offset 0 +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +touch: cannot touch '/mnt/scratch/bar': File exists +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