Skip to contentSkip to conversation

xfs: test xfsdump with bind-mounted filesystem

PATCH New Masayoshi Mizuma 1 participant 1 message Feb 16, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xfs: test xfsdump with bind-mounted filesystem

From: Masayoshi Mizuma <[email protected]>

commit 25195eb ("xfsdump: handle bind mount target") introduced a bug of xfsdump which doesn't store the files to the dump file correctly when the root inode number is changed.

The commit 25195eb is reverted, and commit 0717c1c ("xfsdump: intercept bind mount targets") which is in xfsdump v3.1.10 fixes the bug to reject the filesystem if it's bind-mounted.

Test that xfsdump can reject the bind-mounted filesystem.

---
 tests/xfs/544     | 45 +++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/544.out |  2 ++
 2 files changed, 47 insertions(+)
 create mode 100755 tests/xfs/544
 create mode 100644 tests/xfs/544.out
tests/xfs/544 new file +45 -0
new file mode 100755
index 00000000..11b9713e
@@ -0,0 +1,45 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Fujitsu Limited. All Rights Reserved.
+#
+# FS QA Test 544
+#
+# Regression test for commit:
+# 0717c1c ("xfsdump: intercept bind mount targets")
+
+. ./common/preamble
+_begin_fstest auto dump
+
+_cleanup()
+{
+	_cleanup_dump
+	cd /
+	rm -r -f $tmp.*
+	$UMOUNT_PROG $TEST_DIR/dest 2> /dev/null
+	rmdir $TEST_DIR/src 2> /dev/null
+	rmdir $TEST_DIR/dest 2> /dev/null
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/dump
+
+# real QA test starts here
+
+_supported_fs xfs
+
+# Setup
+mkdir $TEST_DIR/src
+mkdir $TEST_DIR/dest
+
+# Test
+echo "*** dump with bind-mounted test ***" >> $seqres.full
+
+$MOUNT_PROG --bind $TEST_DIR/src $TEST_DIR/dest || _fail "Bind mount failed"
+
+$XFSDUMP_PROG -L session -M test -f $tmp.dump $TEST_DIR/dest \
+	>> $seqres.full 2>&1 && echo "dump with bind-mounted should be failed, but passed."
+
+echo "Silence is golden"
+status=0
+exit
tests/xfs/544.out new file +2 -0
new file mode 100644
index 00000000..fc7ebff3
@@ -0,0 +1,2 @@
+QA output created by 544
+Silence is golden
Signature · 1 line
2.31.1