linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 2/2] btrfs-progs: fsck-test: add test case where one dir has two links
Date: Sun, 18 Jul 2021 20:54:49 +0800	[thread overview]
Message-ID: <20210718125449.311815-2-wqu@suse.com> (raw)
In-Reply-To: <20210718125449.311815-1-wqu@suse.com>

Make sure btrfs check can detect such problem.

Right now we have no way to fix it yet.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 .../049-dir-hard-link/default.img.xz          | Bin 0 -> 1712 bytes
 tests/fsck-tests/049-dir-hard-link/test.sh    |  19 ++++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 tests/fsck-tests/049-dir-hard-link/default.img.xz
 create mode 100755 tests/fsck-tests/049-dir-hard-link/test.sh

diff --git a/tests/fsck-tests/049-dir-hard-link/default.img.xz b/tests/fsck-tests/049-dir-hard-link/default.img.xz
new file mode 100644
index 0000000000000000000000000000000000000000..fd9971acae78975f5263da022feea39e34b45139
GIT binary patch
literal 1712
zcmV;h22c6@H+ooF000E$*0e?f03iV!0000G&sfah3;zaiT>wRyj;C3^v%$$4d1lq4
zhDvnFHzu^a0%EHA+fjUfU^d-f8FD79nuh5qo92GkFUET_5R5Y~d)afdfW4sb2eW+N
z(-N9N;@zX$?eR^yQlFZnSsfYzwplHEI#}i{O3&^g-%*#*J}6=@&Mr933Z)S+DYvtb
z5k;9l__I-yJ`AS&v0F{j8)>U_CUcN9uhMMZ>r0aFa$nT3PO%||kR#<>`b&X;^jZx!
z?T$2In^=Ho4dSN<1OU-V{`iJKl4iT0qZ?qN2!NSUwLkY={)k)$fv5z~^N4kqFTY0A
zY^ShS`wE?^@sQEzTB{J`c&Co>am(cbBo?iCTX8yDg2XD@%iu+8T>Rs=OS3N#=)3bd
z$%Q$2o4Jw~)_B}yv$C$3d8z@>PGT?pn~}TQM)H=}8OiIM$T%7bnT!rm9e8Kj*IY>i
zRi|m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U7m~@-}@QvcEN^UEJ@e6Xm8m=^ZRq
z)cUF@zR;E|i)7w`)u*a&WXIzpygnt3`|17G^sPOyW0?V~!r7SasXdubQAKKtR^|uf
z4;4WRHG()C2~#M*GC^l@k>w3^5M{@6>W%dgSU>Zqn+vNd*2f><3(CVuqAnX=(Zu(G
zF(j4`;!MKu6~PVFgQz$=jt#O~3U4TtOFg;!(X?=T=jRzhT3yzSXD>1GA8~FpzJVnt
zUmIYu;aQe?QMT(4UkP16u@m}5@AX6}DPA>a!#dt3qbX_CfS5)G-*MI@B#;(Ap1`{;
z3VE<Z0{u?EC{{mUj$DSQ|Lv6DL`62yckCVEF6WgD4l%e+sw}4(qMD4Y=X-!VdYJo{
zKb+fu*f8Tk!0fZzzcR|8Tl0H%R#9A&@3h+`YzekzO#*X*=^j()i-pyn&%m-Ln_2H!
z&+nI1M9}8)2($&79_I@LdA5md{Ue@-$tE1%0OeJZ{UaXg=~jG>C#T>wd^;QzL0K(}
z6tjZD62IVa<@fK+TssaPJ~B{H`R=bR5r$9ZK8P2Nah9n(3W~$(5piy!QO^Al)?l4Q
z`5~x}6Pex_Yr=?Q*&mMGj7l@I6&y+9_H<1QmoCJTx0Y6JJmE9n=>iO#ToI;6F9dI)
z!d^0KXk;SSyDf^@yN)Q-8qxAM^Z)=ciSQA~y}h;o0gMfR7ytk~fZMIH#Ao{g00000
G1X)_MbXXt&

literal 0
HcmV?d00001

diff --git a/tests/fsck-tests/049-dir-hard-link/test.sh b/tests/fsck-tests/049-dir-hard-link/test.sh
new file mode 100755
index 000000000000..992ad638bd47
--- /dev/null
+++ b/tests/fsck-tests/049-dir-hard-link/test.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Verify that check can detect overlapped dir with 2 links
+#
+# There is a report that btrfs-check doesn't report dir with 2 links as
+# error, and only get caught by tree-checker.
+#
+# Make sure btrfs check can at least detect such error
+
+source "$TEST_TOP/common"
+
+check_prereq btrfs
+
+check_image() {
+	run_mustfail "dir with 2 links not detected" \
+		"$TOP/btrfs" check "$1"
+}
+
+check_all_images
-- 
2.32.0


  reply	other threads:[~2021-07-18 12:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-18 12:54 [PATCH 1/2] btrfs-progs: check/original: detect directory inode with nlinks >= 2 Qu Wenruo
2021-07-18 12:54 ` Qu Wenruo [this message]
2021-07-19  9:57   ` [PATCH 2/2] btrfs-progs: fsck-test: add test case where one dir has two links Anand Jain
2021-07-19 10:25     ` Qu Wenruo
2021-07-19  0:39 ` [PATCH 1/2] btrfs-progs: check/original: detect directory inode with nlinks >= 2 Su Yue
2021-07-30 13:54 ` David Sterba

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=20210718125449.311815-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;
as well as URLs for NNTP newsgroup(s).