diff mbox series

[13/14] common/parent: check xfs_io parent command paths

Message ID 167899417826.17926.2967499296381728014.stgit@frogsfrogsfrogs (mailing list archive)
State New, archived
Headers show
Series [01/14] xfs/122: update for parent pointers | expand

Commit Message

Darrick J. Wong March 16, 2023, 7:36 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Make sure that the paths returned by the xfs_io parent command actually
point to the same file.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 common/parent |    8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/common/parent b/common/parent
index 8d007bd9ad..f849e4b27c 100644
--- a/common/parent
+++ b/common/parent
@@ -155,6 +155,14 @@  _verify_parent()
 			"but should be $cino"
 	fi
 
+	# Make sure path printing works by checking that the paths returned
+	# all point to the same inode.
+	local tgt="$SCRATCH_MNT/$child_path"
+	$XFS_IO_PROG -x -c 'parent -p' "$tgt" | while read pptr_path; do
+		test "$tgt" -ef "$pptr_path" || \
+			echo "$tgt parent pointer $pptr_path should be the same file"
+	done
+
 	echo "*** Verified parent pointer:"\
 			"name:$PPNAME, namelen:$PPNAME_LEN"
 	echo "*** Parent pointer OK for child $child_path"