]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs: test xfsdump with bind-mounted filesystem
authorMasayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Wed, 16 Feb 2022 14:55:20 +0000 (09:55 -0500)
committerEryu Guan <guaneryu@gmail.com>
Sun, 10 Apr 2022 10:40:50 +0000 (18:40 +0800)
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.

Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/xfs/544 [new file with mode: 0755]
tests/xfs/544.out [new file with mode: 0644]

diff --git a/tests/xfs/544 b/tests/xfs/544
new file mode 100755 (executable)
index 0000000..c7251fc
--- /dev/null
@@ -0,0 +1,47 @@
+#! /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 quick dump
+
+_cleanup()
+{
+       _cleanup_dump
+       cd /
+       rm -r -f $tmp.*
+       $UMOUNT_PROG $TEST_DIR/dest.$seq 2> /dev/null
+       rmdir $TEST_DIR/src.$seq 2> /dev/null
+       rmdir $TEST_DIR/dest.$seq 2> /dev/null
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/dump
+
+# real QA test starts here
+
+_supported_fs xfs
+
+# Setup
+rm -rf $TEST_DIR/src.$seq
+rm -rf $TEST_DIR/dest.$seq
+mkdir $TEST_DIR/src.$seq
+mkdir $TEST_DIR/dest.$seq
+
+# Test
+echo "*** dump with bind-mounted test ***" >> $seqres.full
+
+$MOUNT_PROG --bind $TEST_DIR/src.$seq $TEST_DIR/dest.$seq || _fail "Bind mount failed"
+
+$XFSDUMP_PROG -L session -M test -f $tmp.dump $TEST_DIR/dest.$seq \
+       >> $seqres.full 2>&1 && echo "dump with bind-mounted should be failed, but passed."
+
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/xfs/544.out b/tests/xfs/544.out
new file mode 100644 (file)
index 0000000..fc7ebff
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 544
+Silence is golden