From patchwork Wed Mar 26 12:03:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 14030004 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 C8119C36008 for ; Wed, 26 Mar 2025 12:04:07 +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 1txPUM-000593-QH; Wed, 26 Mar 2025 12:04:06 +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 1txPUL-00058r-92 for linux-f2fs-devel@lists.sourceforge.net; Wed, 26 Mar 2025 12:04:04 +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=RyR9/2IeTRBF8cUIRHU9qvMDFiDLnY/lyJTazMVtPlg=; b=UhFu8EynQ19uF1KF0qLGpvZrzr d13ZrJ5nuABjZb+gg5BSVcNzUCoeyfMr5uE4wQ1X2uh/rxG/kD3jdhro9AV08Lb8L6wJInFABiME8 lxzy+M4ZHUfdER4irNBNS9ZvARbDs+9/OamqvJ6e+rua7NepfasUZkHP0ws4P+moyK24=; 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=RyR9/2IeTRBF8cUIRHU9qvMDFiDLnY/lyJTazMVtPlg=; b=Q tAhM60YdsLcgUhrq1cE8jsP41RQ9sZtHOiZCS0ezRC6NxQ5D9qsPjr3xo7YBJJUpYk8tt2CfL+RN9 ryLNzh9QcnLqdUcVtNTfWLPvXNqGbVzEz6TkVUb/23kpdCPmMUG2uTtPPiJzMaoHhU3VarcF/llvz QI6eEG63Ui/pt3mA=; Received: from tor.source.kernel.org ([172.105.4.254]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1txPUJ-0007NX-RW for linux-f2fs-devel@lists.sourceforge.net; Wed, 26 Mar 2025 12:04:04 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 4086B6112F for ; Wed, 26 Mar 2025 12:03:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84C04C4CEE2; Wed, 26 Mar 2025 12:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1742990631; bh=Y+epb3NLQIDPGyb4Dk0u1R+/gTlL8sesV7u4E5OVk6s=; h=From:To:Cc:Subject:Date:From; b=Cf3Y4PfAO6mQHZ1bcqtJMgZcj6lh+bwCtSFD6EXxixYXhzaqcr9NSxPmFGSOvbXWB SLDEH/64xuO90UU+eSxf6ALJtJFEjbEo7OBTXIrl2uyGbc7n5s4/CgC8+aew7j65F/ 4/e7V5wvwwr75q5U4l9qFtiEDa9stunuOmymB2D79HjlwBRII0VRvaxeLxwbNGbwup 0q7SeurlbgXNtt5l7u9WdK9BzA0K/z+Eq+CuUNRnn/Lw/Q+xdy1ouxH4kDv777INlA RjZewIatkuD3F0MSi8wpd0mKHQOBPwnX5Fp+VctscIH8qYHOHCqi8gL16GpMc/Gw9O gqW8JK+gNsDNA== To: Zorro Lang , fstests@vger.kernel.org Date: Wed, 26 Mar 2025 20:03:41 +0800 Message-ID: <20250326120341.3641535-1-chao@kernel.org> X-Mailer: git-send-email 2.49.0.395.g12beb8f557-goog MIME-Version: 1.0 X-Headers-End: 1txPUJ-0007NX-RW Subject: [f2fs-dev] [PATCH] f2fs/011: test to check out-of-space issue 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: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net This is a regression testcase to check whether we will handle out-of-space case correctly during fallocate() on pinned file once we disable checkpoint. Testcase: 1. mount f2fs w/ checkpoint=disable option 2. create fragmented file data 3. set flag w/ pinned flag 4. fallocate space for pinned file, expects panic due to running out of space. We should apply commit 48ea8b200414 ("f2fs: fix to avoid panic once fallocation fails for pinfile") to avoid system panic. Note that it only fix the issue for regular block device, problem still exist for zoned block device. Cc: Jaegeuk Kim Signed-off-by: Chao Yu --- tests/f2fs/011 | 58 ++++++++++++++++++++++++++++++++++++++++++++++ tests/f2fs/011.out | 2 ++ 2 files changed, 60 insertions(+) create mode 100755 tests/f2fs/011 create mode 100644 tests/f2fs/011.out diff --git a/tests/f2fs/011 b/tests/f2fs/011 new file mode 100755 index 00000000..1ece8fd0 --- /dev/null +++ b/tests/f2fs/011 @@ -0,0 +1,58 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 Chao Yu. All Rights Reserved. +# +# FS QA Test No. f2fs/012 +# +# This is a regression testcase to check whether we will handle +# out-of-space case correctly during fallocate() on pinned file +# once we disable checkpoint. +# 1. mount f2fs w/ checkpoint=disable option +# 2. create fragmented file data +# 3. set flag w/ pinned flag +# 4. fallocate space for pinned file, expects panic due to running +# out of space +# We should apply commit 48ea8b200414 ("f2fs: fix to avoid panic +# once fallocation fails for pinfile") to avoid system panic. +# Note that it only fix the issue for regular block device, problem +# still exist for zoned block device. +# +. ./common/preamble +_begin_fstest auto quick + +_cleanup() +{ + cd / + rm -r -f $tmp.* +} + +_fixed_by_kernel_commit 48ea8b200414 \ + "f2fs: fix to avoid panic once fallocation fails for pinfile" + +_require_scratch +_require_command "$F2FS_IO_PROG" f2fs_io + +_scratch_mkfs_sized $((1*1024*1024*1024)) >> $seqres.full +_scratch_mount -o checkpoint=disable:10% + +pinfile=$SCRATCH_MNT/file + +# simulate fragment status in f2fs +for ((i=0;i<256;i++)) do + dd if=/dev/zero of=$SCRATCH_MNT/$i bs=1M count=1 >>$seqres.full 2>&1 +done +sync + +for ((i=0;i<256;i+=2)) do + rm $SCRATCH_MNT/$i >> $seqres.full 2>&1 +done +sync + +touch $pinfile +$F2FS_IO_PROG pinfile set $pinfile >> $seqres.full +fallocate -l $((3*256*1024*1024)) $pinfile >> $seqres.full 2>&1 + +echo "Silence is golden" + +status=0 +exit diff --git a/tests/f2fs/011.out b/tests/f2fs/011.out new file mode 100644 index 00000000..62e02519 --- /dev/null +++ b/tests/f2fs/011.out @@ -0,0 +1,2 @@ +QA output created by 011 +Silence is golden