From patchwork Mon Mar 10 11:56:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 14009699 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3838722423F for ; Mon, 10 Mar 2025 11:57:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741607838; cv=none; b=CGpnfvU68kXjiQQxfspX9dnZtx8Jobl9Q2/7YWSW73QedoDonb0uW7/FbmJgnEPnr0VPwLhBJ2LoLaGL1VMMYUy+C2FyWJ3m4wygcmFUkq1jJDSDeUODBXGo23sBVS/xwrmOnTuuZr7KFJ/B8LEDzNN9DXY8E3N2mQYhKc1+WP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741607838; c=relaxed/simple; bh=2i2mVcUoEEJErWlRXsEieReXX6af21WasR5ug/fmQrQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=X9WVPdjguliDp1vFTlJVB2M6IvUoZsG+PPPBmrHyGGujeGZQU3vCw4d1ZG/uj8nGILcw765ZSlwfhBiDdR6gCHrn5TFwIcGANpQC0zY26WNq/+ybwdtlY3/Ylqhq1hWLfv4xWU1XRZESUvu1l1J3oAgN5c/IhUvyZW4DdBL+AdA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=q9//8GiC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="q9//8GiC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 202F6C4CEE5; Mon, 10 Mar 2025 11:57:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741607837; bh=2i2mVcUoEEJErWlRXsEieReXX6af21WasR5ug/fmQrQ=; h=From:To:Cc:Subject:Date:From; b=q9//8GiC26nydhcUzbdirCDMSSATbA8Gf0gTX2n8IR4PLTeWNhCS/2C60KvYh7Sid XC4njpdwFpX8LPEoF14n6RuJuZxwAfxzU+qi9ZRjepsv6VhSq1fsn0GAlOoakTuyyy e9SJnMm77X3nfveHZIdW4bUgAUi4tDiUeB3c5xZ14a+aSQunPjTfUwubbL5zQHxKSi eyvkJTp6TG+pM/bMla1tCCZG4wUPBxR4+F9pguVK6ir3fS0ckDaXf50iMrwUaMZ2qS A/Prl1lYHVAyCjxaQnvOI3uN+Nv/ofeWmdPUO7hViLS7sHhr6uUKGohwP0RJKD5RbS iRjD8evrP9h7A== From: Chao Yu To: Zorro Lang , fstests@vger.kernel.org Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, Chao Yu , David Disseldorp Subject: [PATCH v2 1/4] common/config: remove redundant export variables Date: Mon, 10 Mar 2025 19:56:18 +0800 Message-ID: <20250310115621.3441518-1-chao@kernel.org> X-Mailer: git-send-email 2.49.0.rc0.332.g42c0ae87b1-goog Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 F2FS_IO_PROG and TIMEOUT_PROG are exported twice, remove the redundant one. Cc: Jaegeuk Kim Signed-off-by: Chao Yu Reviewed-by: David Disseldorp --- v2: - remove another redundant export variable common/config | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/config b/common/config index 2afbda14..aa525825 100644 --- a/common/config +++ b/common/config @@ -191,7 +191,6 @@ export XFS_COPY_PROG="$(type -P xfs_copy)" export FSTRIM_PROG="$(type -P fstrim)" export DUMPE2FS_PROG="$(type -P dumpe2fs)" export RESIZE2FS_PROG="$(type -P resize2fs)" -export F2FS_IO_PROG="$(type -P f2fs_io)" export FIO_PROG="$(type -P fio)" export FILEFRAG_PROG="$(type -P filefrag)" export E4DEFRAG_PROG="$(type -P e4defrag)" @@ -220,7 +219,6 @@ export UBIUPDATEVOL_PROG="$(type -P ubiupdatevol)" export THIN_CHECK_PROG="$(type -P thin_check)" export PYTHON3_PROG="$(type -P python3)" export SQLITE3_PROG="$(type -P sqlite3)" -export TIMEOUT_PROG="$(type -P timeout)" export SETCAP_PROG="$(type -P setcap)" export GETCAP_PROG="$(type -P getcap)" export CAPSH_PROG="$(type -P capsh)" From patchwork Mon Mar 10 11:56:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 14009700 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A618E22371A for ; Mon, 10 Mar 2025 11:57:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741607840; cv=none; b=h4bF8EMtzy6m6dKJ+z8uAfXd/fRXuqzCZ0haGgJz1TmE1Nbe7UK/AhOGJcTV1b5yb/MZzH/nRwoMGVvYllg81x1oykodn+zUxN7f94xZU/R4ZI1QtPSei3x4VzSnz3Igz1/dlq1AzlBO7JT2+8bVcyln4TyGZfV7D/naM4S2X4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741607840; c=relaxed/simple; bh=TcXToLudWTQwm7xd0ZSu/ToMb6dIoRlNojiaHCyBt3Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WxhYVtxYiAFaSfEL+HFBmSeavZghXX6nn4uKbsrU5dis8HE6h2tCV+kQ7xirJHtWPUvfyi5Dm5dIAwps3bEyS6Ao2cz/s6jtWrbV2AEYDhGxb5mQgC+Rx9ViMvH3mh2u/fS0uATOk2nJu6o8Eye5zoXjpLSIlhH7y/nfyxFMQgU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jKo7kXTo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jKo7kXTo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 255A6C4CEEA; Mon, 10 Mar 2025 11:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741607840; bh=TcXToLudWTQwm7xd0ZSu/ToMb6dIoRlNojiaHCyBt3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jKo7kXTo2TCLKoX9opEo1CaRafE0jLrx6MtjmU5LMgHYglLVOuWzhHD2BzC71DSK+ vTZKcusBwPchQm/JTtAQZ/G1/r30W05YWwGGir8FwtKmvt0abFjj8htNXovlBWfGiV B8S9W98R1iOzb3NPWSmb+ixkPL3WFOaUe/WynwUSC10tL/l4ISCo4+3cFNxzXb3O1R a8XEYf02e/YZnAyN8VcCK9rzIbC90Tg68udo00dHs+NIVgl9PFvG4vdYQg2AKI48U2 Jz7iZvTiGywVz9qtYzk7L299potKrUTOEeFipDEzsUStwuABxuXhfCvXd2IWVDg96H o6iDRv/WTtlyQ== From: Chao Yu To: Zorro Lang , fstests@vger.kernel.org Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, Chao Yu , David Disseldorp Subject: [PATCH v2 2/4] common/config: export F2FS_INJECT_PROG Date: Mon, 10 Mar 2025 19:56:19 +0800 Message-ID: <20250310115621.3441518-2-chao@kernel.org> X-Mailer: git-send-email 2.49.0.rc0.332.g42c0ae87b1-goog In-Reply-To: <20250310115621.3441518-1-chao@kernel.org> References: <20250310115621.3441518-1-chao@kernel.org> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 export F2FS_INJECT_PROG w/ inject.f2fs, it can be used for fault injection. Cc: Jaegeuk Kim Signed-off-by: Chao Yu Reviewed-by: David Disseldorp --- v2: - no changes common/config | 1 + 1 file changed, 1 insertion(+) diff --git a/common/config b/common/config index aa525825..7d017a05 100644 --- a/common/config +++ b/common/config @@ -316,6 +316,7 @@ export MKFS_BTRFS_PROG=$(set_mkfs_prog_path_with_opts btrfs) export MKFS_F2FS_PROG=$(set_mkfs_prog_path_with_opts f2fs) export DUMP_F2FS_PROG=$(type -P dump.f2fs) export F2FS_IO_PROG=$(type -P f2fs_io) +export F2FS_INJECT_PROG=$(type -P inject.f2fs) export BTRFS_UTIL_PROG=$(type -P btrfs) export BTRFS_SHOW_SUPER_PROG=$(type -P btrfs-show-super) export BTRFS_CONVERT_PROG=$(type -P btrfs-convert) From patchwork Mon Mar 10 11:56:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 14009701 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D01C2248A8 for ; Mon, 10 Mar 2025 11:57:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741607843; cv=none; b=faATW2362iaMaDIIHVG491o8kUjx6b3WkznFewLkXEBudmjI5dAvcEmqVsPCooc6ISNHrKdc49VYk3J2BL0x21Z8qYnkdRcaQd9ddnS61pVk9/+lH4OCTFoEFAU7np3Wb73C6sSgwRISZ9X5BhxHQf6Tx7Sd19zu8iI+5puiGl8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741607843; c=relaxed/simple; bh=APeSVQrXiPnNxYprcQjSueJT4IeOKzONOtuiiyk7ccg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ubbobo67f1ZZ5UzJitPtk9NZyTd03r5ET/fp/eUlheLpOqHsQiCEg9aaEoMHgEpCKtIYxTX3AaKUBEVNYhwdVUPtIDhu58o3I8cdy09UkwJ2LeBUPAxEMKxd3tKohgG/fwmMtJLpy1Q3NV0HtnE8rX+gBMDWX56MYxzbQMrjH/o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gYNgfe4D; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gYNgfe4D" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F32FC4CEEF; Mon, 10 Mar 2025 11:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741607842; bh=APeSVQrXiPnNxYprcQjSueJT4IeOKzONOtuiiyk7ccg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gYNgfe4DdC0I6mGTorwXb4AwNSt9FvSx7wjvo6i2EfOcNW/YLlqqXbHkMI7zQA4ZT we1Wx/1kVE/Zt75TvFMg4NkCiqf7iHGgFwlMASxxtCf44KB3rEtB8ROH/BMMJDA1BU jIWOf6rsuTJVvMOqs6zAJTWEIHYL5m94KvrO7LcF/27+ScktWTBsgd/ucHNaP4y6k8 TnX+USBWptYGGYN8C/eQiPAT4dUN43f0hj/8moparKNp1OyTgbMK9EOyobk2eDL1HI kihnr6QMOUMzWff4IGZzdkbm6XZtCKaYZuOFnEGsmH8LGxUszj6rqremdKbhRJxpQP x8aCsuN7PZ0TQ== From: Chao Yu To: Zorro Lang , fstests@vger.kernel.org Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, Chao Yu , David Disseldorp Subject: [PATCH v2 3/4] common/rc: support f2fs in _repair_scratch_fs Date: Mon, 10 Mar 2025 19:56:20 +0800 Message-ID: <20250310115621.3441518-3-chao@kernel.org> X-Mailer: git-send-email 2.49.0.rc0.332.g42c0ae87b1-goog In-Reply-To: <20250310115621.3441518-1-chao@kernel.org> References: <20250310115621.3441518-1-chao@kernel.org> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Support f2fs in _repair_scratch_fs(), and use -f to repair the image forcely. Cc: Jaegeuk Kim Signed-off-by: Chao Yu Reviewed-by: David Disseldorp --- v2: - no changes common/rc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/rc b/common/rc index ca755055..bf24da4e 100644 --- a/common/rc +++ b/common/rc @@ -1500,6 +1500,9 @@ _repair_scratch_fs() # want the test to fail: _check_scratch_fs ;; + f2fs) + fsck -t $FSTYP -f $SCRATCH_DEV + ;; *) local dev=$SCRATCH_DEV local fstyp=$FSTYP From patchwork Mon Mar 10 11:56:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 14009702 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB6972248B5 for ; Mon, 10 Mar 2025 11:57:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741607845; cv=none; b=hKlVi3qX57nXqCDgbA1uCCF7Z1993+OJ0hoLwHbI3A3y2V9XpizcToxfVB1R3uuwiZHTA1aingly4IAc2jdXP5v0uzYeC55EGFvb/lKUZ6ubP7lBzGNc8OznYNaXOLdvGn5bertHtIhlqtIZT816c7QWRhrRrttZKkyoTCc5mcs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741607845; c=relaxed/simple; bh=GXwM4rv65Xwt4R+oS85AFKlhzvJB3Sm5lKewF7AKtVA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hyab2xuJmA/P0DuLu6375Qwq6/lEtPFdyPJAMy6BF3I7Qn7FGTNFfLriH5w5J0j5u88j00J6Ei7mN1fO4veye7gjerRNCMdFTMYEtQmJaduiacvmFXVWeuWV3WBBR0M3bgoRNeU9HyXkfJ1ZjvxjBAXKcxv6iduhikINnmBVrtg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nPir2eoR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nPir2eoR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C2B6C4CEEA; Mon, 10 Mar 2025 11:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741607844; bh=GXwM4rv65Xwt4R+oS85AFKlhzvJB3Sm5lKewF7AKtVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nPir2eoR1GUsB4L4vasstxgPxb92c2zjBGMTPJYtWa99cOgktzWPNJ8onHeFJDZB8 7I/cPCWkRFEKZkcwpa3FvKN6yHE7TzweJv7gRBaKDLoUGNGzyB33Wa0RElwknB4X0C MCHTLLATfPZhGVLG1Pa2nl9v5x7syYuMAYFx2Q2AdHauUksffV0YMfKc2I25TOdjVC waLh76xc0iGhAUjNM8hDZENNKGTUG4lmPl+K5Jm3L8D0qzYusQt+g8NECzCJ5+ZELH tEpNg81g3HqzwJVhmL2fX9xnTJuJZUsQex3g6of+zOXXe9I3D4ie6g/99UjLuOe/2H 0zhAjHZF3aoMw== From: Chao Yu To: Zorro Lang , fstests@vger.kernel.org Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, Chao Yu Subject: [PATCH v2 4/4] f2fs/009: detect and repair nlink corruption Date: Mon, 10 Mar 2025 19:56:21 +0800 Message-ID: <20250310115621.3441518-4-chao@kernel.org> X-Mailer: git-send-email 2.49.0.rc0.332.g42c0ae87b1-goog In-Reply-To: <20250310115621.3441518-1-chao@kernel.org> References: <20250310115621.3441518-1-chao@kernel.org> Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This is a regression test to check whether fsck can handle corrupted nlinks correctly, it uses inject.f2fs to inject nlinks w/ wrong value, and expects fsck.f2fs can detect such corruption and do the repair. Cc: Jaegeuk Kim Signed-off-by: Chao Yu --- v2: - make _scratch_mkfs() to format f2fs image forcely - adjust _check_scratch_fs() to allow specified parameter of f2fs - add _fixed_by_git_commit - add _require_command inject.f2fs - simply return value handling common/rc | 9 ++- tests/f2fs/009 | 133 +++++++++++++++++++++++++++++++++++++++++++++ tests/f2fs/009.out | 2 + 3 files changed, 143 insertions(+), 1 deletion(-) create mode 100755 tests/f2fs/009 create mode 100644 tests/f2fs/009.out diff --git a/common/rc b/common/rc index bf24da4e..e156f3af 100644 --- a/common/rc +++ b/common/rc @@ -993,7 +993,7 @@ _scratch_mkfs() mkfs_filter="grep -v -e ^Warning: -e \"^mke2fs \"" ;; f2fs) - mkfs_cmd="$MKFS_F2FS_PROG" + mkfs_cmd="$MKFS_F2FS_PROG -f" mkfs_filter="cat" ;; ocfs2) @@ -3682,6 +3682,13 @@ _check_scratch_fs() ubifs) # there is no fsck program for ubifs yet ;; + f2fs) + if [ "$FSCK_OPTIONS" == "--dry-run" ]; then + fsck -t $FSTYP $device -- $FSCK_OPTIONS >> $seqres.full 2>&1 + else + _check_generic_filesystem $device + fi + ;; *) _check_generic_filesystem $device ;; diff --git a/tests/f2fs/009 b/tests/f2fs/009 new file mode 100755 index 00000000..d14df968 --- /dev/null +++ b/tests/f2fs/009 @@ -0,0 +1,133 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2025 Chao Yu. All Rights Reserved. +# +# FS QA Test No. f2fs/009 +# +# This is a regression test to check whether fsck can handle corrupted +# nlinks correctly, it uses inject.f2fs to inject nlinks w/ wrong value, +# and expects fsck.f2fs can detect such corruption and do the repair. +# +. ./common/preamble +_begin_fstest auto quick + +_require_scratch +_require_command "$F2FS_INJECT_PROG" inject.f2fs + +_fixed_by_git_commit f2fs-tools 958cd6e + +filename=$SCRATCH_MNT/foo +hardlink=$SCRATCH_MNT/bar + +for ((i=0;i<14;i++)) do + echo "round: " $i >> $seqres.full + + _scratch_mkfs "-f" >> $seqres.full + _scratch_mount >> $seqres.full + + if [ $i == 0 ]; then + touch $filename + ino=`stat -c '%i' $filename` + nlink=0 + elif [ $i == 1 ]; then + mkdir $filename + ino=`stat -c '%i' $filename` + nlink=1 + elif [ $i == 2 ]; then + mknod $filename c 9 0 + ino=`stat -c '%i' $filename` + nlink=0 + elif [ $i == 3 ]; then + mknod $filename b 8 0 + ino=`stat -c '%i' $filename` + nlink=0 + elif [ $i == 4 ]; then + mkfifo $filename + ino=`stat -c '%i' $filename` + nlink=0 + elif [ $i == 5 ]; then + socket -s $filename >> $seqres.full 2>&1 & + pid=$! + sleep 2 + ino=`stat -c '%i' $filename` + kill $pid >> $seqres.full 2>&1 + nlink=0 + elif [ $i == 6 ]; then + ln -s $SCRATCH_MNT/empty $filename + ino=`stat -c '%i' $filename` + nlink=0 + elif [ $i == 7 ]; then + # orphan inode + touch $filename + ino=`stat -c '%i' $filename` + $F2FS_IO_PROG write 1 0 1 zero atomic_commit $filename 5000 >> $seqres.full 2>&1 & + stat $filename >> $seqres.full + rm $filename + $F2FS_IO_PROG shutdown 1 $SCRATCH_MNT/ >> $seqres.full + sleep 6 + nlink=1 + elif [ $i == 8 ]; then + # hardlink on file + touch $filename + ino=`stat -c '%i' $filename` + ln $filename $hardlink + nlink=0 + elif [ $i == 9 ]; then + # hardlink on charactor + mknod $filename c 9 0 + ino=`stat -c '%i' $filename` + ln $filename $hardlink + nlink=0 + elif [ $i == 10 ]; then + # hardlink on blockdev + mknod $filename b 8 0 + ino=`stat -c '%i' $filename` + ln $filename $hardlink + nlink=0 + elif [ $i == 11 ]; then + # hardlink on pipe + mkfifo $filename + ino=`stat -c '%i' $filename` + ln $filename $hardlink + nlink=0 + elif [ $i == 12 ]; then + # hardlink on socket + socket -s $filename >> $seqres.full 2>&1 & + pid=$! + sleep 2 + ino=`stat -c '%i' $filename` + kill $pid >> $seqres.full 2>&1 + ln $filename $hardlink + nlink=0 + elif [ $i == 13 ]; then + # hardlink on symlink + ln -s $SCRATCH_MNT/empty $filename + ino=`stat -c '%i' $filename` + ln $filename $hardlink + nlink=0 + fi + + if [ $i != 7 ]; then + stat $SCRATCH_MNT/* >> $seqres.full + fi + echo "ino:"$ino >> $seqres.full + echo "nlink:"$nlink >> $seqres.full + + _scratch_unmount + + $F2FS_INJECT_PROG --node --mb i_links --nid $ino --val $nlink $SCRATCH_DEV \ + >> $seqres.full || _fail "fail to inject" + + export FSCK_OPTIONS="--dry-run" + _check_scratch_fs >>$seqres.full 2>&1 && _fail "can't find corruption" + _repair_scratch_fs >> $seqres.full + _check_scratch_fs + + _scratch_mount + _scratch_unmount +done + +echo "Silence is golden" + +status=0 +exit diff --git a/tests/f2fs/009.out b/tests/f2fs/009.out new file mode 100644 index 00000000..7e977155 --- /dev/null +++ b/tests/f2fs/009.out @@ -0,0 +1,2 @@ +QA output created by 009 +Silence is golden