Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7057573pxb; Wed, 17 Feb 2021 23:30:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyGLNJtdIDKOhsrnL4byFIbmcdyucPBWIEXfjpzC4tQiNfeArARS6NzeC/V488AhhNmK8Yj X-Received: by 2002:a17:906:71d4:: with SMTP id i20mr2619857ejk.222.1613633433614; Wed, 17 Feb 2021 23:30:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613633433; cv=none; d=google.com; s=arc-20160816; b=XghbEV8ir0l7tszbXBepa8708a65ZjsGxV1N3SQf55huPAvz2t+5PcCHFwDLi0HeXg kxGRxPwW191S91ynFWEFvQttGHOQxiMyCJTvnZvp7D4Wtm8A+OdFQOgFWArw6XfTphTE xCAhfEnBMK/TeSgZVwQaV7vpbPQ3nT4VCxXE76OUYmantC/DQgAHn+kBJoLU3OZsrcra xxt7uNz/bPBjLPcNqmxdlTFmuKdLDm+oxctq7D1SWoqI6VS/F/bppZAfihme7C4KuUu3 40NauEPMGvpbioUI4OiExQ2UrQvau6vGfWEbPeuvVQlg3YXcbEOVO4kkUYhsPEUO3wZx E8Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=DsXxaFmSIY8dERppLdjqfrib0/PA3/hpY+Wbu/fMqtY=; b=veq07+enKltAyWF+AkXGFelHyQtshHYmcJgq6hcpZCBMRbV8Qp3+cSKD+Iyja0t0gA yc70HyftQ7qU/XJA61myI2FlZ5HWlrz9lEBndDcBGpHiDq8aFj42TfKvBHBxUIGa+5rU cn9vUhFdDxEzcbR4wDf8t/ESP4PC7Icsl1FrHC2pf68+E+B2Y+0aJLaXBlWYHiwu1/OT uyKfSkr72KTuzkk8fBgXZrlz8WI/yqLQo3+uX+0t0htIXEwFGgT5AlzfRF1/rAP9KmAF pOqCeEQzup1MUF8idyPkAJEiQSpAZVTnrJ3oAFMX5nRQCGyJF7/jwC8LxYLFT+cenwDV Hlgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aTqMeAAE; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm18si2891033edb.545.2021.02.17.23.30.05; Wed, 17 Feb 2021 23:30:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aTqMeAAE; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229806AbhBRHZ7 (ORCPT + 99 others); Thu, 18 Feb 2021 02:25:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:39146 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231327AbhBRHPD (ORCPT ); Thu, 18 Feb 2021 02:15:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613632413; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=DsXxaFmSIY8dERppLdjqfrib0/PA3/hpY+Wbu/fMqtY=; b=aTqMeAAEECceh013QsQOZnlJbug069K1TGSPfygUKTmMdWFOMsX00HLbepbB+EfJQYiFg9 uwW5ud1trnGgJgpUi43X4vMc+0+NSFFnjoUVZvYVTqHssfe0yKws14/8oabtEEbB2dqhqW EJLsY5VQ9NoSNPXmPPE2YY8qkNXsz5o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-436-oAAoU6iJPQ-XkBszyaY7XA-1; Thu, 18 Feb 2021 02:13:30 -0500 X-MC-Unique: oAAoU6iJPQ-XkBszyaY7XA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 754CD195D562; Thu, 18 Feb 2021 07:13:29 +0000 (UTC) Received: from zlang-laptop.redhat.com (ovpn-13-99.pek2.redhat.com [10.72.13.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AE125D9DC; Thu, 18 Feb 2021 07:13:27 +0000 (UTC) From: Zorro Lang To: fstests@vger.kernel.org Cc: linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, sunke32@huawei.com Subject: [PATCH] xfstests: rename RENAME_WHITEOUT test on fs no enough sapce Date: Thu, 18 Feb 2021 15:13:24 +0800 Message-Id: <20210218071324.50413-1-zlang@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This's a regression test for linux 6b4b8e6b4ad8 ("ext4: fix bug for rename with RENAME_WHITEOUT"). Rename a file with RENAME_WHITEOUT flag might cause corruption when there's not enough space to complete this renaming operation. Signed-off-by: Zorro Lang Signed-off-by: Sun Ke --- Hi, As the request of Sun Ke, I rewrite his test case as this patch. The history of reviewing as below: https://patchwork.kernel.org/project/fstests/patch/20210128061202.210074-1-sunke32@huawei.com/ https://patchwork.kernel.org/project/fstests/patch/20210202123956.3146761-1-sunke32@huawei.com/ At last, I decide to create several chunks of files to do this testing, help to get more chance to trigger ENOSPC when does rename(RENAME_WHITEOUT). From my testing, it can reproduce this bug on linux 5.10[1], and test passed on linux 5.11-rc5+ [2]. And it works on XFS too. Hope to get more review from fs-devel. [1] # ./check generic/623 FSTYP -- ext4 PLATFORM -- Linux/x86_64 ibm-xxxxxxx-xx 5.10.0-rc5+ #4 SMP Tue Jan 5 20:12:45 CST 2021 MKFS_OPTIONS -- /dev/mapper/testvg-scratchdev MOUNT_OPTIONS -- -o acl,user_xattr -o context=system_u:object_r:root_t:s0 /dev/mapper/testvg-scratchdev /mnt/scratch generic/623 _check_generic_filesystem: filesystem on /dev/mapper/testvg-scratchdev is inconsistent (see /root/git/xfstests-zlang/results//generic/623.full for details) - output mismatch (see /root/git/xfstests-zlang/results//generic/623.out.bad) --- tests/generic/623.out 2021-02-18 13:26:35.953071523 +0800 +++ /root/git/xfstests-zlang/results//generic/623.out.bad 2021-02-18 13:28:10.450733088 +0800 @@ -1,2 +1,232 @@ QA output created by 623 +ls: cannot access '/mnt/scratch/srcfile3866': Structure needs cleaning +ls: cannot access '/mnt/scratch/srcfile3867': Structure needs cleaning +ls: cannot access '/mnt/scratch/srcfile3868': Structure needs cleaning +ls: cannot access '/mnt/scratch/srcfile3869': Structure needs cleaning +ls: cannot access '/mnt/scratch/srcfile3870': Structure needs cleaning +ls: cannot access '/mnt/scratch/srcfile3871': Structure needs cleaning ... (Run 'diff -u /root/git/xfstests-zlang/tests/generic/623.out /root/git/xfstests-zlang/results//generic/623.out.bad' to see the entire diff) Ran: generic/623 Failures: generic/623 Failed 1 of 1 tests [2] # ./check generic/623 FSTYP -- ext4 PLATFORM -- Linux/x86_64 localhost 5.11.0-0.rc5.20210128git76c057c84d28.137.fc34.x86_64 #1 SMP Thu Jan 28 21:10:47 UTC 2021 MKFS_OPTIONS -- /dev/mapper/testvg-scratchdev MOUNT_OPTIONS -- -o acl,user_xattr -o context=system_u:object_r:root_t:s0 /dev/mapper/testvg-scratchdev /mnt/scratch generic/623 4s ... 86s Ran: generic/623 Passed all 1 tests [3] # ./check generic/623 FSTYP -- xfs (non-debug) PLATFORM -- Linux/x86_64 localhost 5.11.0-0.rc5.20210128git76c057c84d28.137.fc34.x86_64 #1 SMP Thu Jan 28 21:10:47 UTC 2021 MKFS_OPTIONS -- -f -bsize=4096 /dev/mapper/testvg-scratchdev MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/mapper/testvg-scratchdev /mnt/scratch generic/623 86s ... 99s Ran: generic/623 Passed all 1 tests Thanks, Zorro tests/generic/623 | 72 +++++++++++++++++++++++++++++++++++++++++++ tests/generic/623.out | 2 ++ tests/generic/group | 1 + 3 files changed, 75 insertions(+) create mode 100755 tests/generic/623 create mode 100644 tests/generic/623.out diff --git a/tests/generic/623 b/tests/generic/623 new file mode 100755 index 00000000..56358ca6 --- /dev/null +++ b/tests/generic/623 @@ -0,0 +1,72 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2021 HUAWEI. All Rights Reserved. +# Copyright (c) 2021 Red Hat Inc. All Rights Reserved. +# +# FS QA Test 623 +# +# Test RENAME_WHITEOUT on filesystem without space to create one more inodes. +# This is a regression test for kernel commit: +# 6b4b8e6b4ad8 ("ext4: ext4: fix bug for rename with RENAME_WHITEOUT") +# +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/filter +. ./common/populate + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs generic +_require_scratch + +_scratch_mkfs_sized $((256 * 1024 * 1024)) >> $seqres.full 2>&1 +_scratch_mount + +# Create several chunks of file, to help to trigger the bug easily +CHUNKS=$((64 * 64)) +for ((i=0; i> $seqres.full 2>&1 +# Use empty files to fill the rest +for ((i=0; i<10000; i++));do + touch $SCRATCH_MNT/fill_file$i 2>/dev/null + # Until no more files can be created + if [ $? -ne 0 ];then + break + fi +done +# ENOSPC is expected here +for ((i=0; i> $seqres.full 2>&1 +done +_scratch_cycle_mount +# Expect no errors at here +for ((i=0; i/dev/null +done + +echo "Silence is golden" +# success, all done +status=0 +exit diff --git a/tests/generic/623.out b/tests/generic/623.out new file mode 100644 index 00000000..6f774f19 --- /dev/null +++ b/tests/generic/623.out @@ -0,0 +1,2 @@ +QA output created by 623 +Silence is golden diff --git a/tests/generic/group b/tests/generic/group index b10fdea4..72136075 100644 --- a/tests/generic/group +++ b/tests/generic/group @@ -625,3 +625,4 @@ 620 auto mount quick 621 auto quick encrypt 622 auto shutdown metadata atime +623 auto rename enospc -- 2.29.2