From: Yang Xu <xuyang2018.jy@fujitsu.com>
To: <fstests@vger.kernel.org>
Cc: Yang Xu <xuyang2018.jy@fujitsu.com>
Subject: [PATCH v2 2/2] xfs/191: test xfs_db get corrupted value
Date: Tue, 5 Jul 2022 17:20:08 +0800 [thread overview]
Message-ID: <1657012808-2204-2-git-send-email-xuyang2018.jy@fujitsu.com> (raw)
In-Reply-To: <1657012808-2204-1-git-send-email-xuyang2018.jy@fujitsu.com>
This is a regression test that xfs_db code doesn't clean up the
LIBXFS_READBUF_SALVAGE call sites in set_cur so that we
can't use the return value directly and scraping it out later.
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
tests/xfs/191 | 33 +++++++++++++++++++++++++++++++++
tests/xfs/191.out | 5 +++++
2 files changed, 38 insertions(+)
create mode 100755 tests/xfs/191
create mode 100644 tests/xfs/191.out
diff --git a/tests/xfs/191 b/tests/xfs/191
new file mode 100755
index 00000000..98e9e186
--- /dev/null
+++ b/tests/xfs/191
@@ -0,0 +1,33 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 FUJITSU LIMITED. All rights reserved.
+#
+# FS QA Test 191
+#
+# Regression test for xfsprogs commit
+# f4afdcb0ad11 ("xfs_db: clean up the salvage read callsites in set_cur()")
+#
+# This case test xfs_db whether can get the new magicnum field value even we
+# just have corrupted this field value.
+#
+
+. ./common/preamble
+_begin_fstest auto quick
+
+# Import common functions.
+. ./common/filter
+
+# real QA test starts here
+_supported_fs xfs
+
+_scratch_mkfs_xfs >>$seqres.full 2>&1
+
+# write the bad magicnum field value(0) to the superblock
+_scratch_xfs_set_metadata_field "magicnum" "0" "sb 1"
+
+#Even magicnum filed has been corrupted, we still can read this filed value
+_scratch_xfs_get_metadata_field "magicnum" "sb 1"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/191.out b/tests/xfs/191.out
new file mode 100644
index 00000000..71826198
--- /dev/null
+++ b/tests/xfs/191.out
@@ -0,0 +1,5 @@
+QA output created by 191
+Allowing write of corrupted data with good CRC
+magicnum = 0
+bad magic number
+0
--
2.27.0
next prev parent reply other threads:[~2022-07-05 8:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-05 9:20 [PATCH v2 1/2] xfs/270: Fix syntax error Yang Xu
2022-07-05 9:20 ` Yang Xu [this message]
2022-07-19 5:21 ` [PATCH v2 2/2] xfs/191: test xfs_db get corrupted value Zorro Lang
2022-07-19 6:59 ` xuyang2018.jy
2022-07-19 2:13 ` [PATCH v2 1/2] xfs/270: Fix syntax error xuyang2018.jy
2022-07-19 5:13 ` Zorro Lang
2022-07-19 8:31 ` [PATCH v3 " Yang Xu
2022-07-19 8:31 ` [PATCH v3 2/2] xfs/533: test xfs_db whether still can get corrupted field value Yang Xu
2022-07-19 14:47 ` 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=1657012808-2204-2-git-send-email-xuyang2018.jy@fujitsu.com \
--to=xuyang2018.jy@fujitsu.com \
--cc=fstests@vger.kernel.org \
/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