From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6ACF1C7618A for ; Thu, 16 Mar 2023 19:35:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230102AbjCPTfh (ORCPT ); Thu, 16 Mar 2023 15:35:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229794AbjCPTfg (ORCPT ); Thu, 16 Mar 2023 15:35:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E316F265AC; Thu, 16 Mar 2023 12:35:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6E7CAB8233B; Thu, 16 Mar 2023 19:35:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01562C433EF; Thu, 16 Mar 2023 19:35:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678995332; bh=sUnxusCjM7KbBV1sOapwU/pO0WMHXTiwdOMaQy9glDE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=o+ccnGjxvfWMLjClUEzM9956N721ZCtQ7Kdb+q6xl7tLW/n2dsDL5iYQJpWM9xeVo YhDfBCqwvlgnXL4zwkuqo72slNthom9Cqa4A08unyKfFuV/0p6HMafXM7RnDmzRR2o qYvJvRemvYL33nsjcrYd8Ke19rvaszE4jClaiOwZ59oxLRySEKO2IR+rDltus4xsfY dUe10apeHsltXc+cbTmqIek8KRugfns0+7ocOjI/D5jdpOkNuBXXLYJpn6a8vu0Xeo XYfS0MdxNtLskWWc9J80TZcIibPZwIM/IoBDdlFNcRD5GnpN9pqD/mkZoUFJnkqqrS OGBVMxYXgwuLg== Date: Thu, 16 Mar 2023 12:35:31 -0700 Subject: [PATCH 10/14] xfs: add parent pointer inject test From: "Darrick J. Wong" To: zlang@redhat.com, djwong@kernel.org Cc: Allison Henderson , Catherine Hoang , linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me Message-ID: <167899417787.17926.2362113251411757974.stgit@frogsfrogsfrogs> In-Reply-To: <167899417650.17926.7405859750613330339.stgit@frogsfrogsfrogs> References: <167899417650.17926.7405859750613330339.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Allison Henderson Add a test to verify parent pointers after an error injection and log replay. Signed-off-by: Allison Henderson Signed-off-by: Catherine Hoang Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- tests/xfs/853 | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/853.out | 14 +++++++++ 2 files changed, 99 insertions(+) create mode 100755 tests/xfs/853 create mode 100644 tests/xfs/853.out diff --git a/tests/xfs/853 b/tests/xfs/853 new file mode 100755 index 0000000000..f17f4b7e9e --- /dev/null +++ b/tests/xfs/853 @@ -0,0 +1,85 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test 853 +# +# parent pointer inject test +# +. ./common/preamble +_begin_fstest auto quick parent + +# get standard environment, filters and checks +. ./common/filter +. ./common/inject +. ./common/parent + +# Modify as appropriate +_supported_fs xfs +_require_scratch +_require_xfs_sysfs debug/larp +_require_xfs_io_error_injection "larp" +_require_xfs_parent +_require_xfs_io_command "parent" + +# real QA test starts here + +# Create a directory tree using a protofile and +# make sure all inodes created have parent pointers + +protofile=$tmp.proto + +cat >$protofile <>$seqres.full 2>&1 \ + || _fail "mkfs failed" +_check_scratch_fs + +_scratch_mount >>$seqres.full 2>&1 \ + || _fail "mount failed" + +testfolder1="testfolder1" +testfolder2="testfolder2" +file4="file4" +file5="file5" + +echo "" + +# Create files +touch $SCRATCH_MNT/$testfolder1/$file4 +_verify_parent "$testfolder1" "$file4" "$testfolder1/$file4" + +# Inject error +_scratch_inject_error "larp" + +# Move files +mv $SCRATCH_MNT/$testfolder1/$file4 $SCRATCH_MNT/$testfolder2/$file5 2>&1 \ + | _filter_scratch + +# FS should be shut down, touch will fail +touch $SCRATCH_MNT/$testfolder2/$file5 2>&1 | _filter_scratch + +# Remount to replay log +_scratch_remount_dump_log >> $seqres.full + +# FS should be online, touch should succeed +touch $SCRATCH_MNT/$testfolder2/$file5 + +# Check files again +_verify_parent "$testfolder2" "$file5" "$testfolder2/$file5" + +# success, all done +status=0 +exit diff --git a/tests/xfs/853.out b/tests/xfs/853.out new file mode 100644 index 0000000000..56247c1434 --- /dev/null +++ b/tests/xfs/853.out @@ -0,0 +1,14 @@ +QA output created by 853 + +*** testfolder1 OK +*** testfolder1/file4 OK +*** testfolder1/file4 OK +*** Verified parent pointer: name:file4, namelen:5 +*** Parent pointer OK for child testfolder1/file4 +mv: cannot stat 'SCRATCH_MNT/testfolder1/file4': Input/output error +touch: cannot touch 'SCRATCH_MNT/testfolder2/file5': Input/output error +*** testfolder2 OK +*** testfolder2/file5 OK +*** testfolder2/file5 OK +*** Verified parent pointer: name:file5, namelen:5 +*** Parent pointer OK for child testfolder2/file5