From patchwork Sun Oct 22 03:40:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13431628 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F29A6C001DF for ; Sun, 22 Oct 2023 03:41:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230104AbjJVDkj (ORCPT ); Sat, 21 Oct 2023 23:40:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbjJVDkg (ORCPT ); Sat, 21 Oct 2023 23:40:36 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1AC611B for ; Sat, 21 Oct 2023 20:40:33 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 06A891FDC7 for ; Sun, 22 Oct 2023 03:40:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1697946032; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hvLZzufsD0C5mynKDJKHpBlZd5XqixKKPKIy8kc6FO4=; b=Ol70R42tz4QycsYDWjeyHe17T0LhLvaDD230RVa8IO8rfUg9dRakfMamNLYvqMisua17M1 fznvdLknMgODjcg1D0Pwd5JlOiy1nnDPP+SLgWZdhxs80NeRWg+7ldReEh6lLTZ6vhFwcT oOlc6kk+BZi9XhgkR34NdZUwwQDlkaA= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 345191348C for ; Sun, 22 Oct 2023 03:40:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8KBZOK6ZNGVHZwAAMHmgww (envelope-from ) for ; Sun, 22 Oct 2023 03:40:30 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Subject: [PATCH 3/3] btrfs-progs: fsck-tests: add test image of out-of-order inline backref items Date: Sun, 22 Oct 2023 14:10:09 +1030 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Authentication-Results: smtp-out2.suse.de; none X-Spamd-Result: default: False [-2.10 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[linux-btrfs@vger.kernel.org]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-3.00)[-1.000]; TO_DN_NONE(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; DBL_PROHIBIT(0.00)[0.0.0.9:email,0.0.0.2:email]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org Issue #622 reported a case where ntfs2btrfs can generate out-of-order inline backref items, which can lead to kernel transaction abort, but not detected by btrfs-check. This patch would add such image, whose extent tree looks like this for the only data extent: item 0 key (13631488 EXTENT_ITEM 4096) itemoff 16172 itemsize 111 refs 3 gen 7 flags DATA (178 0xdfb591fa80d95ea) extent data backref root FS_TREE objectid 257 offset 0 count 1 (178 0xdfb591fbbf5f519) extent data backref root FS_TREE objectid 258 offset 0 count 1 (178 0xdfb591f49f9f8e7) extent data backref root FS_TREE objectid 259 offset 0 count 1 While the original good base image has the following backrefs for the same data extent: item 0 key (13631488 EXTENT_ITEM 4096) itemoff 16172 itemsize 111 refs 3 gen 7 flags DATA (178 0xdfb591fbbf5f519) extent data backref root FS_TREE objectid 258 offset 0 count 1 (178 0xdfb591fa80d95ea) extent data backref root FS_TREE objectid 257 offset 0 count 1 (178 0xdfb591f49f9f8e7) extent data backref root FS_TREE objectid 259 offset 0 count 1 Notice the sequence (the 2nd number in the round brackets) should be descending. (Meanwhie type should be ascending, but it's way harder to create) For now we don't have a way to fix it, but at least we should detect it. Signed-off-by: Qu Wenruo --- .../btrfs_image.xz | Bin 0 -> 2264 bytes .../061-out-of-order-inline-backref/test.sh | 19 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/fsck-tests/061-out-of-order-inline-backref/btrfs_image.xz create mode 100755 tests/fsck-tests/061-out-of-order-inline-backref/test.sh diff --git a/tests/fsck-tests/061-out-of-order-inline-backref/btrfs_image.xz b/tests/fsck-tests/061-out-of-order-inline-backref/btrfs_image.xz new file mode 100644 index 0000000000000000000000000000000000000000..65c10617bc250edce2affb3ed91c359041119345 GIT binary patch literal 2264 zcmV;}2q*XbH+ooF000E$*0e?f03iVu0001VFXf})5B~_3T>wRyj;C3^v%$$4d1t#p zhA1?^)9Q?YaslDA79H>>{UD9*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5jL$x!<`&C<~`rI?PdEf>F6g z5xBOR52i*tg@QiUSlv8$xmj>e*m5h;%DF&lQbS~Yb7GfE;t5$TyBGB?2qlMm34&wi zR!+G7&HN)T3iLZ)JFLYRyom6(+9lf%S!-gK`b&dIQ=86+^q=hR1pK63`0}1AIou(C z`rKd%Ni&gRf}?4l3KN4V>; zjSuCZQ6D*dxemFsucgi?s*wy)8bDxm*6MT*UJFsTsdE3NqtqQIImzP|*% zteC9i`^XvP4esR#q53gW;ayfa6y<}enU@x&GUh8?=X}b^HMoe?qIJS00M@L}uJVEY zbz)EAuqdyrr@)iuk{AAv8V_EL&sI^(`|CG?BNJ1=MG%H$i6By7UD5{P1d-zNE{QD} z5q^aqWy7#PzZrqKE72thI~Owi#p5D?@@aXX3Ox?2SxnK(m}j*9vH=QEyb}$1H*?m6 zNOsp5*O_yteiZ7BIiMCn!5JJ6iL+TXB2v6!j>+$l@TzZBjHHh2#FklJCBOt45M7*= z?Jf>Ub|O(c|BOkXh1nl6wvh`xkKm!?61jYG-oSS`^vH`zVJ2P6`i>MvfT9UYI@)gu ztKT};o&$LJJd>HY8fJ>gPjh6Qinb(svJFeDagU1vGdafKT3QO`*8SoJba!C3rimp6 zX?o402q{VtY}oJTFvpxKT6&25@H6@j=QNW6l@9@J9WTqq1Ixzqoa}*=f!dO&p|gNF z@%2>k+xs=J#i2iaEap!Q^Lk?y^4}Fn^E=aj9X}hp=v&Kt}JqflP9ExJn8Io)| zE?#x?PWc6%<}NRL;5Qu=us?;N3NDAPaCsRr8+nVNoY@;2zl3N_MBn}4jg7I7Ind+) m0002EWz9KhnPQ&+0kRQ*AOHYLD8n4F#Ao{g000001X)@%f>$&E literal 0 HcmV?d00001 diff --git a/tests/fsck-tests/061-out-of-order-inline-backref/test.sh b/tests/fsck-tests/061-out-of-order-inline-backref/test.sh new file mode 100755 index 000000000000..f80d58f416f0 --- /dev/null +++ b/tests/fsck-tests/061-out-of-order-inline-backref/test.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Verify that check can detect out-of-order inline backref items. +# +# There is a report that one ntfs2btrfs generated some out-of-order inline +# backref items, while btrfs-check failed to detect it at all. +# +# Make sure btrfs check can at least detect such error. + +source "$TEST_TOP/common" + +check_prereq btrfs + +check_image() { + run_mustfail "out-of-order inline backref items not detected" \ + "$TOP/btrfs" check "$1" +} + +check_all_images