From patchwork Sat Oct 12 10:15:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13833374 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9A0A7CF2564 for ; Sat, 12 Oct 2024 10:15:25 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1szZ9g-0003bV-11; Sat, 12 Oct 2024 10:15:23 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1szZ9e-0003bP-N8 for linux-f2fs-devel@lists.sourceforge.net; Sat, 12 Oct 2024 10:15:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jgGj4r4W/yh23dfQEriacMi/uNNP+CTkrP7BeJ/x0aA=; b=jk9c0nuYSS1hfCfm5wn23tmync KhazfFq+q6YOTf4F9nAS/G/19ARhbswN+OZI+vr97vn8/otPNQrF4OtpVSaF8FoNsfMp6ozzZ7VVB TjFqoibwajR9Ex/g7Qk3pvgQccgdQh37IAjBMOz/Oq0QxFBbXXm9reQUdwE+Fs0uLpgs=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=jgGj4r4W/yh23dfQEriacMi/uNNP+CTkrP7BeJ/x0aA=; b=j y9z+kt6CNX3ZrPNM3v0JZ3TwSdEGyRgNGKcOiQ192wF6P8PcWT7jSqAa6JyENJy2/3FiGrEIJygwY sMqW4TQfAQsS80RlxwOEw+++7kmHBQylpaEmr0ozlMAOzsUDVD6PWtbkU3BRx0H0sokIaNDh0SPsJ LJR2HPh0Mp7DkcBE=; Received: from nyc.source.kernel.org ([147.75.193.91]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1szZ9d-0006qE-6b for linux-f2fs-devel@lists.sourceforge.net; Sat, 12 Oct 2024 10:15:22 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id AA66CA4013E; Sat, 12 Oct 2024 10:15:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB425C4CEC6; Sat, 12 Oct 2024 10:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728728110; bh=OdH4TBBkFTCEwViZ350PE+nPM3XleI6+E0e5t7R/34g=; h=From:To:Cc:Subject:Date:From; b=Vl8I4Bq59AlmRmq43BJsY5HjQa/0hbbAFkAIW9fImqm+VtBwFj6ErqkoeFEZWNpmI 7jlL9OaSLd2JpgYjNsRseJRc72HkE+lZqgab+/n4jWDk0o7uaH+PXtcY1L0LAHLeqq r47DLy7FGWaOjbP+0Be+VjpzLi8o4neH0oGxr0eD4rxgzkCs9O8wgKvdSXAKG1ZmJ3 XYvoflqStZEniEdgFxm60aHIwxLgVbaXQbnRDQeQgu21k19PlLFQJlDQ7DC6oTyWoC bIqgwH5sZkg893nZJCx3s0drHxCrvcERGWbpsKN+BkO+74BwtSz2oJyEJUXET/UNqg +FUduMyuN/Y5g== To: Zorro Lang Date: Sat, 12 Oct 2024 18:15:01 +0800 Message-Id: <20241012101501.377899-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Headers-End: 1szZ9d-0006qE-6b Subject: [f2fs-dev] [PATCH] f2fs/005: add testcase to check checkpoint disabling functionality X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Chao Yu via Linux-f2fs-devel From: Chao Yu Reply-To: Chao Yu Cc: Qi Han , fstests@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net This patch introduce a regression test to check whether f2fs handles dirty inode correctly when checkpoint is disabled in a corner case, it may hang umount before the bug is fixed. Cc: Qi Han Signed-off-by: Chao Yu --- tests/f2fs/005 | 59 ++++++++++++++++++++++++++++++++++++++++++++++ tests/f2fs/005.out | 1 + 2 files changed, 60 insertions(+) create mode 100755 tests/f2fs/005 create mode 100644 tests/f2fs/005.out diff --git a/tests/f2fs/005 b/tests/f2fs/005 new file mode 100755 index 00000000..4faf1bb9 --- /dev/null +++ b/tests/f2fs/005 @@ -0,0 +1,59 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Oppo. All Rights Reserved. +# +# FS QA Test No. f2fs/005 +# +# This is a regression test to check whether f2fs handles dirty +# inode correctly when checkpoint is disabled, it may hang umount +# before the bug is fixed. +# +. ./common/preamble +_begin_fstest auto quick + +_cleanup() +{ + rm -f $img + rmdir $mnt + _scratch_unmount >> $seqres.full + cd / + rm -r -f $tmp.* +} + +_require_scratch +_scratch_mkfs >> $seqres.full +_scratch_mount >> $seqres.full + +img=$SCRATCH_MNT/f2fs.img +mnt=$SCRATCH_MNT/f2fs.mnt +testfile=$mnt/testfile +tmpfile=$mnt/tmpfile +tmpdir=$mnt/tmpdir + +mkdir $mnt +dd if=/dev/zero of=$img bs=1M count=50 2>/dev/null +$MKFS_F2FS_PROG -f $img >/dev/null 2>&1 +sync + +# use mode=lfs to let f2fs always triggers OPU +mount -t $FSTYP -o loop,mode=lfs,checkpoint=disable:10%,noinline_dentry $img $mnt + +dd if=/dev/zero of=$testfile bs=1M count=5 2>/dev/null +mkdir $tmpdir +touch $tmpfile +sync + +# it dirties tmpdir inode by updating ctime, +# but it doesn't moving the inode to gdirty_list. +mv $tmpfile $tmpdir + +# it runs out of free segment +dd if=/dev/zero of=$testfile bs=1M count=5 conv=notrunc conv=fsync 2>/dev/null + +mount -o remount,checkpoint=enable $mnt + +# it may hang umount if tmpdir is still dirty during evict() +umount $mnt + +status=0 +exit diff --git a/tests/f2fs/005.out b/tests/f2fs/005.out new file mode 100644 index 00000000..caa3c880 --- /dev/null +++ b/tests/f2fs/005.out @@ -0,0 +1 @@ +QA output created by 005