From: "Darrick J. Wong" <djwong@kernel.org>
To: guaneryu@gmail.com, zlang@redhat.com
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org, guan@eryu.me
Subject: [PATCH v2.1 4/9] xfs: test xfs_copy doesn't do cached read before libxfs_mount
Date: Wed, 29 Jun 2022 17:48:14 -0700 [thread overview]
Message-ID: <YrzyzsYZDx9AI4fy@magnolia> (raw)
In-Reply-To: <165644770013.1045534.5572366430392518217.stgit@magnolia>
From: Darrick J. Wong <djwong@kernel.org>
This is a regression test for an xfs_copy fix that ensures that it
doesn't perform a cached read of an XFS filesystem prior to initializing
libxfs, since the xfs_mount (and hence the buffer cache) isn't set up
yet.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
tests/xfs/844 | 38 ++++++++++++++++++++++++++++++++++++++
tests/xfs/844.out | 3 +++
2 files changed, 41 insertions(+)
create mode 100755 tests/xfs/844
create mode 100644 tests/xfs/844.out
diff --git a/tests/xfs/844 b/tests/xfs/844
new file mode 100755
index 00000000..32349c85
--- /dev/null
+++ b/tests/xfs/844
@@ -0,0 +1,38 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 Oracle. All Rights Reserved.
+#
+# FS QA Test 844
+#
+# Regression test for xfsprogs commit:
+#
+# XXXXXXXX ("xfs_copy: don't use cached buffer reads until after libxfs_mount")
+#
+# It was discovered that passing xfs_copy a source device containing an ext4
+# filesystem would cause xfs_copy to crash. Further investigation revealed
+# that any readable path that didn't have a plausible XFS superblock in block
+# zero would produce the same crash, so this regression test exploits that.
+#
+. ./common/preamble
+_begin_fstest auto copy quick
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs generic
+_require_xfs_copy
+_require_test
+
+rm -f $TEST_DIR/$seq.*
+$XFS_IO_PROG -f -c 'truncate 100m' $TEST_DIR/$seq.a
+$XFS_IO_PROG -f -c 'truncate 100m' $TEST_DIR/$seq.b
+
+filter_copy() {
+ sed -e 's/Superblock has bad magic number.*/bad magic number/'
+}
+
+$XFS_COPY_PROG $TEST_DIR/$seq.a $TEST_DIR/$seq.b 2>&1 | filter_copy
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/844.out b/tests/xfs/844.out
new file mode 100644
index 00000000..dbefde1c
--- /dev/null
+++ b/tests/xfs/844.out
@@ -0,0 +1,3 @@
+QA output created by 844
+bad magic number
+xfs_copy: couldn't read superblock, error=22
next prev parent reply other threads:[~2022-06-30 0:48 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 20:21 [PATCHSET 0/9] fstests: random fixes Darrick J. Wong
2022-06-28 20:21 ` [PATCH 1/9] seek_sanity_test: fix allocation unit detection on XFS realtime Darrick J. Wong
2022-06-29 7:41 ` Christoph Hellwig
2022-07-28 1:37 ` liuyd.fnst
2022-07-28 2:31 ` Darrick J. Wong
2022-07-28 2:37 ` Darrick J. Wong
2022-07-28 3:38 ` liuyd.fnst
2022-07-28 3:54 ` Darrick J. Wong
2022-06-28 20:21 ` [PATCH 2/9] xfs/070: filter new superblock verifier messages Darrick J. Wong
2022-06-29 4:15 ` Dave Chinner
2022-06-29 9:12 ` Zorro Lang
2022-06-29 22:41 ` Darrick J. Wong
2022-06-30 2:18 ` Zorro Lang
2022-06-28 20:21 ` [PATCH 3/9] xfs: test mkfs.xfs sizing of internal logs that Darrick J. Wong
2022-06-29 4:18 ` Dave Chinner
2022-06-29 22:43 ` Darrick J. Wong
2022-06-30 6:37 ` Zorro Lang
2022-06-30 19:32 ` Darrick J. Wong
2022-06-28 20:21 ` [PATCH 4/9] xfs: test xfs_copy doesn't do cached read before libxfs_mount Darrick J. Wong
2022-06-29 4:20 ` Dave Chinner
2022-06-29 22:46 ` Darrick J. Wong
2022-06-30 0:48 ` Darrick J. Wong [this message]
2022-07-01 1:06 ` [PATCH v2.1 " Dave Chinner
2022-06-28 20:21 ` [PATCH 5/9] check: document mkfs.xfs reliance on fstests exports Darrick J. Wong
2022-06-29 4:22 ` Dave Chinner
2022-06-28 20:21 ` [PATCH 6/9] xfs/109: handle larger minimum filesystem size Darrick J. Wong
2022-06-29 4:22 ` Dave Chinner
2022-06-28 20:21 ` [PATCH 7/9] xfs/018: fix LARP testing for small block sizes Darrick J. Wong
2022-06-28 20:22 ` [PATCH 8/9] xfs/166: fix golden output failures when multipage folios enabled Darrick J. Wong
2022-06-29 4:23 ` Dave Chinner
2022-06-28 20:22 ` [PATCH 9/9] xfs/547: fix problems with realtime Darrick J. Wong
2022-07-05 14:28 ` [PATCHSET 0/9] fstests: random fixes Zorro Lang
2022-07-05 22:04 ` Darrick J. Wong
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=YrzyzsYZDx9AI4fy@magnolia \
--to=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=guan@eryu.me \
--cc=guaneryu@gmail.com \
--cc=linux-xfs@vger.kernel.org \
--cc=zlang@redhat.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;
as well as URLs for NNTP newsgroup(s).