From mboxrd@z Thu Jan 1 00:00:00 1970 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 CE9EFC433FE for ; Fri, 14 Oct 2022 23:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229544AbiJNXEh (ORCPT ); Fri, 14 Oct 2022 19:04:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbiJNXEg (ORCPT ); Fri, 14 Oct 2022 19:04:36 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84D0A32A99 for ; Fri, 14 Oct 2022 16:04:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1665788671; bh=J3978gCthlPSc9L5uJ0lhPt3GAWZEw36iqP03hOgVAk=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=VsWQkGi+X0O16aAPhS1S6QlgXbXASoGyW1xxo1wZ/l2BOcpQPEe2N1rPkE4B51dt8 /oRCgWnW9VG0r+oD3aNyRWnoMYbfSLvzhTuM6m6jmBPZQNcM8r96zg2612YanXeaOo g/RsUJzY9dJzkiNwrPimj5IoyePR3j0AtOfyrvy4= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [0.0.0.0] ([149.28.201.231]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MAwbp-1oplFH1ykT-00BIys; Sat, 15 Oct 2022 01:04:31 +0200 Message-ID: <794674a0-a58b-2e8f-acba-d779537e71d3@gmx.com> Date: Sat, 15 Oct 2022 07:04:27 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v2 15/15] btrfs: introduce a debug mount option to do error injection for each stage of open_ctree() To: Josef Bacik , Qu Wenruo Cc: linux-btrfs@vger.kernel.org References: Content-Language: en-US From: Qu Wenruo In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:y7fpmQgxAmoS2JPpke6imOcPaEqmetaulSASNaX55mCNb/L0ESw rDZutBWHyVdkwepl7KaIzaxEKIvlW4pmL8sivKNRy8KsB/pqL8aw9qbd1l4aQEKSY9xadP6 lo2kDy9HUMWEKwR3zAnxLDoRQX3AHoy+9rCTZJc3kPdvYVPe4mNR9lcOSvyoCZzxXA5/dfo e5g1VA1tHaiguhc5vrDtw== X-UI-Out-Filterresults: notjunk:1;V03:K0:E0wU0tFExag=:HrxqKyNmgsbFqm7BgNerKm N099MLDlEii6W0VyN+O0bFWNNyIzc5Nl0QfoV2wlsxD+LBKcDDLO7mKH8mABgC/PyyU17u83i ltX7d2MydnZuTb9OYUXEd5WLgNkbtgQx2LlmnYU+CyiItqAMCe0W+sCp5y7jSPiq/Ilz2VJq3 90lv8SGqymWcgR9jpunPg5NUnVs7plLOWKMl/RvDOW07CH5aq36T9NCGATwbesp4LpV00FFNG UKnoVQxzWLsyP0MKBDZNhn3L1qTolWVs5mhCvMUXK2pJt1X5jnvUptfup5W3lNaljRW2KZcto 9fcwd6vMzT5WXWtBu3WNzJAMHGoqDDZB9JchmLmq2zJDXcgV646rVtV5PuoK9T1nJesIcA165 68lKw+6KBzH209bBHrZXK6KvtiZtCpJATc0w5YMKYRfOyr8aGDhVKTpa+MlbJr4K6r3aWPQeP GmTkbXafZztjDLGC4RrTRbtsbAur32t2Vz01CVHSAYDxf77HE0YDtYhdoOgootP+lUJbXdIBl 8dnIIS0fEevRy3DLuao4+k6lAeFBxi836ntFk7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s@vger.kernel.org On 2022/10/14 20:43, Josef Bacik wrote: > On Wed, Oct 12, 2022 at 05:13:11PM +0800, Qu Wenruo wrote: >> With the new open_ctree_seq[] array, we can afford a debug mount option >> to do all the error inject at different stages to have a much better >> coverage for the error path. >> >> The new "fail_mount=3D%u" mount option will be hidden behind >> CONFIG_BTRFS_DEBUG option, and when enabled it will cause mount failure >> just after the init function of specified stage. >> >> This can be verified by the following script: >> >> mkfs.btrfs -f $dev >> for (( i=3D0;; i++ )) do >> mount -o fail_mount=3D$i $dev $mnt >> ret=3D$? >> if [ $ret -eq 0 ]; then >> umount $mnt >> exit >> fi >> done >> umount $mnt >> >> Signed-off-by: Qu Wenruo > > Death to all mount options, especially for this. I'd rather see somethi= ng like > this inserted in the main loop > > bool btrfs_mail_fail_init(struct btrfs_fs_info *fs_info, int seq) > { > return false; > } > ALLOW_ERROR_INJECTION(btrfs_may_fail_init); IIRC the error injection system can not do a proper conditional injection according to the @seq parameter. > > and then we can error inject that way. Alternatively you could just use > ALLOW_ERROR_INJECTION for every one of the init/exit functions and achei= ve the > same thing. Thanks, That is even worse. The problem of injecting error directly into init functions is - No exit will be called if init failed As we all expect the init function to cleanup itself if something wrong happened Another problem is, it's much harder to test, we need to inject errors to different functions, while a debug only mount option can easily test the whole thing just with different fail stage number. Thanks, Qu > > Josef