[PATCH 1/2] xfs: test what happens when we reset the root dir and it has xattrs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

Make sure that we can reset the root directory and the xattrs are erased
properly.

Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
---
 tests/xfs/757     |   63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/757.out |    7 ++++++
 tests/xfs/group   |    1 +
 3 files changed, 71 insertions(+)
 create mode 100755 tests/xfs/757
 create mode 100644 tests/xfs/757.out


diff --git a/tests/xfs/757 b/tests/xfs/757
new file mode 100755
index 00000000..0b9914f6
--- /dev/null
+++ b/tests/xfs/757
@@ -0,0 +1,63 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2021 Oracle.  All Rights Reserved.
+#
+# FS QA Test No. 757
+#
+# Make sure that attrs are handled properly when repair has to reset the root
+# directory.
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 7 15
+
+_cleanup()
+{
+	cd /
+	rm -rf $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/populate
+. ./common/fuzzy
+
+# real QA test starts here
+_supported_fs xfs
+_require_scratch_nocheck
+
+rm -f $seqres.full
+
+echo "Format and populate btree attr root dir"
+_scratch_mkfs > "$seqres.full" 2>&1
+_scratch_mount
+
+blksz="$(stat -f -c '%s' "${SCRATCH_MNT}")"
+__populate_create_attr "${SCRATCH_MNT}" "$((64 * blksz / 40))" true
+_scratch_unmount
+
+echo "Break the root directory"
+_scratch_xfs_fuzz_metadata_field core.mode zeroes 'sb 0' 'addr rootino' >> $seqres.full 2>&1
+
+echo "Detect bad root directory"
+_scratch_xfs_repair -n >> $seqres.full 2>&1 && \
+	echo "Should have detected bad root dir"
+
+echo "Fix bad root directory"
+_scratch_xfs_repair >> $seqres.full 2>&1
+
+echo "Detect fixed root directory"
+_scratch_xfs_repair -n >> $seqres.full 2>&1
+
+echo "Mount test"
+_scratch_mount
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/757.out b/tests/xfs/757.out
new file mode 100644
index 00000000..9f3aed5a
--- /dev/null
+++ b/tests/xfs/757.out
@@ -0,0 +1,7 @@
+QA output created by 757
+Format and populate btree attr root dir
+Break the root directory
+Detect bad root directory
+Fix bad root directory
+Detect fixed root directory
+Mount test
diff --git a/tests/xfs/group b/tests/xfs/group
index 731f869c..76e31167 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -528,5 +528,6 @@
 537 auto quick
 538 auto stress
 539 auto quick mount
+757 auto quick attr repair
 908 auto quick bigtime
 909 auto quick bigtime quota




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux