public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Masayoshi Mizuma <msys.mizuma@gmail.com>
To: fstests@vger.kernel.org
Cc: Masayoshi Mizuma <msys.mizuma@gmail.com>,
	Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>,
	linux-xfs@vger.kernel.org
Subject: [PATCH] xfs: test xfsdump with bind-mounted filesystem
Date: Mon, 14 Feb 2022 15:34:09 -0500	[thread overview]
Message-ID: <20220214203409.10309-1-msys.mizuma@gmail.com> (raw)

From: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com>

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>
---
 tests/xfs/544     | 63 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/544.out |  2 ++
 2 files changed, 65 insertions(+)
 create mode 100755 tests/xfs/544
 create mode 100644 tests/xfs/544.out

diff --git a/tests/xfs/544 b/tests/xfs/544
new file mode 100755
index 00000000..1d586ebc
--- /dev/null
+++ b/tests/xfs/544
@@ -0,0 +1,63 @@
+#! /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 $mntpnt2 2> /dev/null
+	rmdir $mntpnt1/dir 2> /dev/null
+	$UMOUNT_PROG $mntpnt1 2> /dev/null
+	rmdir $mntpnt2 2> /dev/null
+	rmdir $mntpnt1 2> /dev/null
+	[ -n "$loopdev" ] && _destroy_loop_device $loopdev
+	rm -f "$TEST_DIR"/fsfile
+}
+
+# Import common functions.
+. ./common/filter
+. ./common/dump
+
+# real QA test starts here
+
+_supported_fs xfs
+
+mntpnt1=$TEST_DIR/MNT1
+mntpnt2=$TEST_DIR/MNT2
+
+
+# Set up
+$MKFS_XFS_PROG -s size=4096 -b size=4096 \
+	-dfile,name=$TEST_DIR/fsfile,size=8649728b,sunit=1024,swidth=2048 \
+	>> $seqres.full 2>&1 || _fail "mkfs failed"
+
+loopdev=$(_create_loop_device "$TEST_DIR"/fsfile)
+
+mkdir $mntpnt1 >> $seqres.full 2>&1 || _fail "mkdir \"$mntpnt1\" failed"
+
+_mount $loopdev $mntpnt1
+mkdir $mntpnt1/dir >> $seqres.full 2>&1 || _fail "mkdir \"$mntpnt1/dir\" failed"
+mkdir $mntpnt2 >> $seqres.full 2>&1 || _fail "mkdir \"$mntpnt2\" failed"
+
+
+# Test
+echo "*** dump with bind-mounted test ***" >> $seqres.full
+
+mount -o bind $mntpnt1/dir $mntpnt2
+
+$XFSDUMP_PROG -L session -M test -f $tmp.dump $mntpnt2 \
+	>> $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
index 00000000..fc7ebff3
--- /dev/null
+++ b/tests/xfs/544.out
@@ -0,0 +1,2 @@
+QA output created by 544
+Silence is golden
-- 
2.31.1


             reply	other threads:[~2022-02-14 20:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 20:34 Masayoshi Mizuma [this message]
2022-02-16  7:07 ` [PATCH] xfs: test xfsdump with bind-mounted filesystem Zorro Lang
2022-02-16 14:32   ` Masayoshi Mizuma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220214203409.10309-1-msys.mizuma@gmail.com \
    --to=msys.mizuma@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=m.mizuma@jp.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox