From patchwork Thu Mar 16 19:35:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13178282 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 B1179C6FD1F for ; Thu, 16 Mar 2023 19:35:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230287AbjCPTfK (ORCPT ); Thu, 16 Mar 2023 15:35:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbjCPTfH (ORCPT ); Thu, 16 Mar 2023 15:35:07 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69FE1410A5; Thu, 16 Mar 2023 12:35:04 -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 sin.source.kernel.org (Postfix) with ESMTPS id 7DD2BCE1E66; Thu, 16 Mar 2023 19:35:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFA19C433D2; Thu, 16 Mar 2023 19:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678995300; bh=D1hxR4hcDzI7zaQzeJcSLRF+m5fWvV0FuHl3W1BItCY=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=ip2hGFqwD6Cat1TZJ1V88JG39kcnCcAj61A7K96e+lsfYyutHzMKZEruuHsnXIhre cnUhnwa7nTppWMj7uZRv8NYSKhMgO42XEDYUWkedqSVhDG8/JyCc/TCxatbnKqjHT1 Mfz09fvqG2ZG0iyeC0GwxmP4HQabeDDBOQG80mQqcynmmEwuqqRsDiIYOQGKKByU7W gsbZF9eqhvdhFQOaLLAFzjBSa6/IRY6Q5RwmKy3toJlWhPt7Xmx7EKWQ2D6+vPyXjA nBIQ1hEjPBBh0JmwbsPLeRZrueRjygB5bryMTCMbo8bobTd8VaEzJiJSH+yM3SATF9 e3PLJHrtBzi/A== Date: Thu, 16 Mar 2023 12:35:00 -0700 Subject: [PATCH 08/14] xfs: add parent pointer 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: <167899417760.17926.6271389612360061946.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 Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org From: Allison Henderson Add a test to verify basic parent pointers operations (create, move, link, unlink, rename, overwrite). Signed-off-by: Allison Henderson Signed-off-by: Catherine Hoang Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- doc/group-names.txt | 1 + tests/xfs/851 | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/851.out | 59 ++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+) create mode 100755 tests/xfs/851 create mode 100644 tests/xfs/851.out diff --git a/doc/group-names.txt b/doc/group-names.txt index 819039e311..87e0933103 100644 --- a/doc/group-names.txt +++ b/doc/group-names.txt @@ -83,6 +83,7 @@ nfs4_acl NFSv4 access control lists nonsamefs overlayfs layers on different filesystems online_repair online repair functionality tests other dumping ground, do not add more tests to this group +parent Parent pointer tests pattern specific IO pattern tests perms access control and permission checking pipe pipe functionality diff --git a/tests/xfs/851 b/tests/xfs/851 new file mode 100755 index 0000000000..27870ec05a --- /dev/null +++ b/tests/xfs/851 @@ -0,0 +1,101 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2022, Oracle and/or its affiliates. All Rights Reserved. +# +# FS QA Test 851 +# +# simple parent pointer test +# + +. ./common/preamble +_begin_fstest auto quick parent + +# get standard environment, filters and checks +. ./common/parent + +# Modify as appropriate +_supported_fs xfs +_require_scratch +_require_xfs_sysfs debug/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" +file1="file1" +file2="file2" +file3="file3" +file1_ln="file1_link" + +echo "" +# Create parent pointer test +_verify_parent "$testfolder1" "$file1" "$testfolder1/$file1" + +echo "" +# Move parent pointer test +mv $SCRATCH_MNT/$testfolder1/$file1 $SCRATCH_MNT/$testfolder2/$file1 +_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1" + +echo "" +# Hard link parent pointer test +ln $SCRATCH_MNT/$testfolder2/$file1 $SCRATCH_MNT/$testfolder1/$file1_ln +_verify_parent "$testfolder1" "$file1_ln" "$testfolder1/$file1_ln" +_verify_parent "$testfolder1" "$file1_ln" "$testfolder2/$file1" +_verify_parent "$testfolder2" "$file1" "$testfolder1/$file1_ln" +_verify_parent "$testfolder2" "$file1" "$testfolder2/$file1" + +echo "" +# Remove hard link parent pointer test +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file1)" +rm $SCRATCH_MNT/$testfolder2/$file1 +_verify_parent "$testfolder1" "$file1_ln" "$testfolder1/$file1_ln" +_verify_no_parent "$file1" "$ino" "$testfolder1/$file1_ln" + +echo "" +# Rename parent pointer test +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder1/$file1_ln)" +mv $SCRATCH_MNT/$testfolder1/$file1_ln $SCRATCH_MNT/$testfolder1/$file2 +_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2" +_verify_no_parent "$file1_ln" "$ino" "$testfolder1/$file2" + +echo "" +# Over write parent pointer test +touch $SCRATCH_MNT/$testfolder2/$file3 +_verify_parent "$testfolder2" "$file3" "$testfolder2/$file3" +ino="$(stat -c '%i' $SCRATCH_MNT/$testfolder2/$file3)" +mv -f $SCRATCH_MNT/$testfolder2/$file3 $SCRATCH_MNT/$testfolder1/$file2 +_verify_parent "$testfolder1" "$file2" "$testfolder1/$file2" + +# success, all done +status=0 +exit diff --git a/tests/xfs/851.out b/tests/xfs/851.out new file mode 100644 index 0000000000..c375ba5f00 --- /dev/null +++ b/tests/xfs/851.out @@ -0,0 +1,59 @@ +QA output created by 851 + +*** testfolder1 OK +*** testfolder1/file1 OK +*** testfolder1/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder1/file1 + +*** testfolder2 OK +*** testfolder2/file1 OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder2/file1 + +*** testfolder1 OK +*** testfolder1/file1_link OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder1 OK +*** testfolder2/file1 OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder2/file1 +*** testfolder2 OK +*** testfolder1/file1_link OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder2 OK +*** testfolder2/file1 OK +*** testfolder2/file1 OK +*** Verified parent pointer: name:file1, namelen:5 +*** Parent pointer OK for child testfolder2/file1 + +*** testfolder1 OK +*** testfolder1/file1_link OK +*** testfolder1/file1_link OK +*** Verified parent pointer: name:file1_link, namelen:10 +*** Parent pointer OK for child testfolder1/file1_link +*** testfolder1/file1_link OK + +*** testfolder1 OK +*** testfolder1/file2 OK +*** testfolder1/file2 OK +*** Verified parent pointer: name:file2, namelen:5 +*** Parent pointer OK for child testfolder1/file2 +*** testfolder1/file2 OK + +*** testfolder2 OK +*** testfolder2/file3 OK +*** testfolder2/file3 OK +*** Verified parent pointer: name:file3, namelen:5 +*** Parent pointer OK for child testfolder2/file3 +*** testfolder1 OK +*** testfolder1/file2 OK +*** testfolder1/file2 OK +*** Verified parent pointer: name:file2, namelen:5 +*** Parent pointer OK for child testfolder1/file2