Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1564073rwl; Mon, 26 Dec 2022 01:02:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXuxc82YA365R5hfzxgEn4qtpUnGQ+dCd85tjFLgGSQXkpWnikjjjcogVfCXUJn5SUcI4Scw X-Received: by 2002:a05:6402:2283:b0:46b:aa:8564 with SMTP id cw3-20020a056402228300b0046b00aa8564mr14139296edb.30.1672045350953; Mon, 26 Dec 2022 01:02:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672045350; cv=none; d=google.com; s=arc-20160816; b=fmvNW/2NDP0fbL+jFihaMkBkreu+wnUWp/5vQPQEL7C6IzMOhUAgAv9K0dPH6C93t/ HVC2t8Z7hGrb/iRptfzajrpfTuDizchbAdcbwc2WUY7Zjb07KXtCcS3xBS5X/b9OqzRE dKHOuwJZXXByOFyAFHmro2fMaBErGFzw9UmketgB0/ARTcmWS/ar5MVdc0r/hWm+7a2L SSGsAZyQqHlaOCmK9ZeKg+6MORzdqhRXqsSjNb/+xifTwNDDEcGJtVDz6mUxfrNUSOPi K/1RYhS6u7gOTRyr/Rkn/b0xguXqb0LOKXRoDRBieOI070Z3EbgYb3QJnfOqzqc7cOD5 oYKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:in-reply-to:subject:from :references:cc:to:content-language:user-agent:mime-version:date :message-id; bh=o4Yd0bxxBAKxgHXLt9FHcVYtRQOvrsMSTT72OCg7p70=; b=pIH6I+cdIailEZ6MRIl1YPXPt3nx4w+TW9nkjo5hHPbeVYrmIhDFmv3klhdv3No9xQ Jk+JednDn4ycDWgyPs9g1Hr83iQrzGPttFFhZUxpfEul9DaWdj0++fuW3cAZkgmrdROV h9lftCogGl23Q2/FUTaZiQT6LvcIcKlsJq17wc5tsaqpEKTLtoyMCQGv/nNCv+EIA5Vf sOSYvNU3nxtDbAtIWjBCFH7K042LwHkjc1R3rGz+glPtr2nrMTIu0xubv9qGSIhDWAQO QvpT7PDq/FRhtwDwOcTMwWrS0SzIHxHlw44naaU8GsFDFOp9uHEEZiML8DmoKXwPa8GS v+zg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf27-20020a1709077f1b00b007bdf57f885esi9002187ejc.37.2022.12.26.01.02.15; Mon, 26 Dec 2022 01:02:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231899AbiLZIre (ORCPT + 66 others); Mon, 26 Dec 2022 03:47:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231593AbiLZIrb (ORCPT ); Mon, 26 Dec 2022 03:47:31 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D64C5103; Mon, 26 Dec 2022 00:47:29 -0800 (PST) Received: from [0.0.0.0] ([149.28.201.231]) by mail.gmx.net (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1ML9yc-1pRnzT1FT8-00IDmA; Mon, 26 Dec 2022 09:47:26 +0100 Content-Type: multipart/mixed; boundary="------------ayHqvGI0q04d6op00JQAIbv0" Message-ID: <0036622d-53f7-eaba-f720-6dd9bdca28ad@gmx.com> Date: Mon, 26 Dec 2022 16:47:16 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Content-Language: en-US To: Mikhail Gavrilov Cc: wqu@suse.com, dsterba@suse.com, Btrfs BTRFS , Linux List Kernel Mailing References: <18b5fa1e-7d1e-4560-c98b-d7ac5fc87c3a@gmx.com> From: Qu Wenruo Subject: Re: [6.2][regression] after commit 947a629988f191807d2d22ba63ae18259bb645c5 btrfs volume periodical forced switch to readonly after a lot of disk writes In-Reply-To: X-Provags-ID: V03:K1:c/o9oxf5gRtPg6nNIODqSNwpQ+WmR5bFK9QrH3IoQgpaCVRNoNY fWByYbEuhHTDqsYKdlMnaCqMpFb2TwvouFPnuc4ig3Xm5jr+Y4U3auFGjmniZKTjdTeWGa+ caHwEMOqQGLqswKUqCGX5qL6wtfJy83SN0Paam+09cS3F6ZiBBbCmgbH6SGN4TSswiRtUwi SbMCGxAFWqQw3/kRO3FLQ== UI-OutboundReport: notjunk:1;M01:P0:w188Ug7Ygos=;nNRh2DrG+NfxJBjYvJ1Aatq8wuj +CHWE9YJYA4HIy2tRy5vmZp0f/l42Uev50eZjHpqetbZcSR2h9Z7k5wkB/gDnetLlrW8dc/mx FpqusZS8tvhmQSLqNxceMw7StsP1KZ3RtK8JErmty2nPTRNLOWLiMcS/5oo/tMSWicG/XfO1t PNekl1HouNXVrZwjDU2Xl3I7Y31dve9mqiuOu0CK3wbQL6ZbbCOCwMXx+3Udj+KwERHaYQ0wm vBqu4TZLmM/zeF+N+b7l9KmmY6rZUxHI3wQ/+zYW6QtS5vmgPJpV6N1l1mLyvhHRw7Oxgw5r8 ESHolmxJoZWyvjL8tpIXZNsb7wgWY6AvXmLu0Ayr4Ot+6+VOYAEb9juF5wW/tGmu0QdcitQtP r+KxSHUQemCF7y/7Ljd3MznqAx1Lb9IKWrtUAOtLM/CbdQQn06LxxC8qE3FBLeG0tjqIuZSL8 6K3gsLhDUjaVYhii60eP2AnaamhETbzXJue855Y7c4JKaO1pY8VUQcvq17HpdOJJrekPIc1WS rXvtakBrO7M9rvbmaFKQzmDO9BIZ2aXoaBwuoAYpn8u45j8FNBGk2AMCES0UlTiuAzkLq8AWl zliIaD83IxddF5M2F+1ITlvlroSjIcWHlQmoaFhAwqs5geGBj7u341OpcHlJFGa2zh1w6kES2 pUjWg9F9GTTKDgidI+Vuxwrk8yJbp9Xkh8NesU6KAWMokzfhK0yArOKq8isR5mBLDNJNK8y/w bOZkEXh5ZmAy8yzxd/8+MtrGCtFiyUA/MQW6CvGB1iHGmd0ysQQa/Al3O9TjpmuufPF1irHgX nllBEK8vuoaNiF8KHKFOyqeOxwkpcwCT/WLNFBtgFdBDT0YKFtZkJAs/5ZAHkOMOHS6NQRof9 7EPWlBvc1t9UfxFVRlXbqmEBp6jULjXhH6TCbeR1aLgKyH8qltCxz4ov2zOAp1A7mYP33FA05 bs5AwH+FGdicy52YlBv6xUbGMkc= X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,FREEMAIL_FROM, NICE_REPLY_A,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------ayHqvGI0q04d6op00JQAIbv0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2022/12/26 16:15, Mikhail Gavrilov wrote: > On Mon, Dec 26, 2022 at 8:29 AM Qu Wenruo wrote: >> >> >> OK, indeed a level mismatch. >> >> From the remaining lines, it shows we're failing at >> do_free_extent_accounting(), which failed at the btrfs_del_csums(). >> >> And inside btrfs_del_csums(), what we do are all regular btree >> operations, thus the tree level check should work without problem. >> >> Thus it seems to be a corrupted csum tree. > > Do I need to debug anything else to understand the cause of the error? > Thanks. With the check output, it's indeed a runtime error. (At least no corruption to your fs) And it can be some call paths not properly initializing the level to check. Here is the new debug patch. It should be applied without any previous debug patch. Thanks, Qu > >> Could you please run "btrfs check --readonly" from a liveCD? >> There are tons of possible false alerts if ran on a RW mounted fs. >> > > # btrfs check --readonly /dev/nvme0n1p3 > Opening filesystem to check... > Checking filesystem on /dev/nvme0n1p3 > UUID: 40e0b5d2-df54-46e0-b6f4-2f868296271d > [1/7] checking root items > [2/7] checking extents > [3/7] checking free space tree > [4/7] checking fs roots > [5/7] checking only csums items (without verifying data) > [6/7] checking root refs > [7/7] checking quota groups skipped (not enabled on this FS) > found 6828416307200 bytes used, no error found > total csum bytes: 6651838248 > total tree bytes: 16378380288 > total fs tree bytes: 7483179008 > total extent tree bytes: 1228210176 > btree space waste bytes: 2413299694 > file data blocks allocated: 6899999100928 > referenced 7488299450368 > [root@localhost-live ~]# > > With liveCD looks like all OK (no errors found). > --------------ayHqvGI0q04d6op00JQAIbv0 Content-Type: text/x-patch; charset=UTF-8; name="0001-btrfs-add-extra-debug-for-level-mismatch.patch" Content-Disposition: attachment; filename="0001-btrfs-add-extra-debug-for-level-mismatch.patch" Content-Transfer-Encoding: base64 RnJvbSBjOTkzMmQ0MDU5NGRhNjA2NTEyNWI3NmI1NWJkOWNlYTFmYWJjODEyIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpNZXNzYWdlLUlkOiA8Yzk5MzJkNDA1OTRkYTYwNjUxMjViNzZi NTViZDljZWExZmFiYzgxMi4xNjcyMDQ0MzkyLmdpdC53cXVAc3VzZS5jb20+CkZyb206IFF1 IFdlbnJ1byA8d3F1QHN1c2UuY29tPgpEYXRlOiBNb24sIDI2IERlYyAyMDIyIDE2OjQ0OjA4 ICswODAwClN1YmplY3Q6IFtQQVRDSF0gYnRyZnM6IGFkZCBleHRyYSBkZWJ1ZyBmb3Ig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