From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 2/2] btrfs-progs: fsck-tests: Add test case to ensure btrfs check return error for corrupted qgroups
Date: Mon, 30 Apr 2018 14:17:00 +0800 [thread overview]
Message-ID: <20180430061700.18498-2-wqu@suse.com> (raw)
In-Reply-To: <20180430061700.18498-1-wqu@suse.com>
Since the test case uses run_mustfail(), which is pretty easy pass due to
other unexpected problems, so here an extra run_check() is added to
ensure we don't only report qgroup error, but also fix it without
problem.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
.../032-corrupted-qgroup/qgroup_corrupted.img | Bin 0 -> 3072 bytes
tests/fsck-tests/032-corrupted-qgroup/test.sh | 19 ++++++++++++++++++
2 files changed, 19 insertions(+)
create mode 100644 tests/fsck-tests/032-corrupted-qgroup/qgroup_corrupted.img
create mode 100755 tests/fsck-tests/032-corrupted-qgroup/test.sh
diff --git a/tests/fsck-tests/032-corrupted-qgroup/qgroup_corrupted.img b/tests/fsck-tests/032-corrupted-qgroup/qgroup_corrupted.img
new file mode 100644
index 0000000000000000000000000000000000000000..a19a303534d419fa7660615d0dcf25ad314e7b20
GIT binary patch
literal 3072
zcmeH|XHe7G8peZ25!j#v5fFhzB*@YhrCfzT5TpxB?*gl=6d?pJod8jKRaQZyh2D$Q
z00FWJ5wi${wviS<iGZ}w4dlO)xjQ<}-0%Crcg~#m_ntGSJkOk&lj!~!Id{Pk2l`*I
zf6gq-_8In%2DQvS*C5bwW<SX6fujM?5R-?Gu$#o>F(!{Nx#rkW@jbpf@ZEubu>(PG
z+t1`!_C#_>vtjeXh^tM(!>}_(EkZ(hLV|+$xg@jwAZTiSBPHnOjm#KU8*y_mOOjd=
zf8?u6Q5RLp#LqvkV&!KgCu=2~j)lj+Qc)~$=pO9mqMi`f@niL0qlbY_HTI;g6L${j
z2OH-~#`RPvI)!>7ky7<g9-g|!DUj6DK}%`Ox)9zV^~8mE?X5zn+JghOD%w_^3x5*&
z7e%h?cxgelG76|@?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b/tests/fsck-tests/032-corrupted-qgroup/test.sh
new file mode 100755
index 000000000000..ccecfeac3ca3
--- /dev/null
+++ b/tests/fsck-tests/032-corrupted-qgroup/test.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+# To check if btrfs check can handle valid orphan items.
+# Orphan item is a marker for deleted inodes that were open at the time of
+# deletion. # Orphan inode/root will is not referenced and will have an orphan
+# item, which should not be reported as error.
+
+source "$TEST_TOP/common"
+
+check_prereq btrfs
+
+check_image() {
+ run_mustfail "btrfs check failed to detect qgroup corruption" \
+ "$TOP/btrfs" check "$1"
+ # Above command can fail due to other bugs, so add extra safe net to
+ # ensure we can fix qgroup without problem.
+ run_check "$TOP/btrfs" check --repair "$1"
+}
+
+check_all_images
--
2.17.0
next prev parent reply other threads:[~2018-04-30 6:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-30 6:16 [PATCH 1/2] btrfs-progs: check: Make btrfs check return error for qgroup mismatch Qu Wenruo
2018-04-30 6:17 ` Qu Wenruo [this message]
2018-05-08 17:45 ` David Sterba
2018-05-10 1:43 ` Qu Wenruo
2018-05-10 11:45 ` David Sterba
2018-05-10 12:17 ` Qu Wenruo
-- strict thread matches above, loose matches on Subject: below --
2018-04-30 6:28 Qu Wenruo
2018-04-30 6:28 ` [PATCH 2/2] btrfs-progs: fsck-tests: Add test case to ensure btrfs check return error for corrupted qgroups Qu Wenruo
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=20180430061700.18498-2-wqu@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@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