From af628757847719290d9a6ce5c7f2aae7c11dee10 Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Sun, 18 Jul 2021 20:54:49 +0800 Subject: [PATCH] btrfs-progs: tests: check nlinks for directories Make sure btrfs check can detect such problem. Right now we have no way to fix it yet. Reviewed-by: Anand Jain Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- .../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%s0@W^`QQLHd#kk%hsBhG;@X+L^icR9?z+_VJJC$Xiwp#%2bqwqgAl7R=b$=TKgrNtsjTs>%c()OaRth)4EnpQ5JVZ^(KTPzrUX{p9;-ybSWq%f z+h=IPq3LWP%?;tzwce-qMY!>K!A5@FkSm-}C%Z0i|p;ur0NT-IX6}s8Rm!mfP zPXw?{gkFl<_oY!Dd@ggcd1EGiS(3Q(7 zs81W|!q{6Sla!9bbNKzzP+95lMs6qCdis3( zxIT1wv2PKhAZso_!f!HtAShXA6eHuXWK0`PVh5TX(wgYr!l9e|jW&M_)DRcZBVfPyNr$65P*t{sM-vjL`XqP~HHY0FV{L*~3B=dzP+MOU1@ zRYWfI#vm2^g>N$aie=a^L(xQu@pRjw4DXt%wU7m~@-}@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`{; z3VEC#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 00000000..755cdcac --- /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