linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2 15/15] btrfs: introduce a debug mount option to do error injection for each stage of open_ctree()
Date: Fri, 14 Oct 2022 08:43:24 -0400	[thread overview]
Message-ID: <Y0lZbFnapZ6Z3Xcv@localhost.localdomain> (raw)
In-Reply-To: <cb7312a3d6c88100df88dc61c911e6d5e8455070.1665565866.git.wqu@suse.com>

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=%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=0;; i++ )) do
> 	mount -o fail_mount=$i $dev $mnt
> 	ret=$?
> 	if [ $ret -eq 0 ]; then
> 		umount $mnt
> 		exit
> 	fi
>  done
>  umount $mnt
> 
> Signed-off-by: Qu Wenruo <wqu@suse.com>

Death to all mount options, especially for this.  I'd rather see something 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);

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 acheive the
same thing.  Thanks,

Josef

  reply	other threads:[~2022-10-14 12:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12  9:12 [PATCH v2 00/15] btrfs: make open_ctree() init/exit sequence strictly matched Qu Wenruo
2022-10-12  9:12 ` [PATCH v2 01/15] btrfs: initialize fs_info->sb at the very beginning of open_ctree() Qu Wenruo
2022-10-12  9:12 ` [PATCH v2 02/15] btrfs: remove @fs_devices argument from open_ctree() Qu Wenruo
2022-10-12  9:12 ` [PATCH v2 03/15] btrfs: extract btree inode init code into its own init/exit helpers Qu Wenruo
2022-10-12  9:13 ` [PATCH v2 04/15] btrfs: extract super block read code into its own init helper Qu Wenruo
2022-10-12  9:13 ` [PATCH v2 05/15] btrfs: extract mount options and features init " Qu Wenruo
2022-10-12  9:13 ` [PATCH v2 06/15] btrfs: move btrfs_init_workqueus() and btrfs_stop_all_workers() into open_ctree_seq[] Qu Wenruo
2022-10-12  9:13 ` [PATCH v2 07/15] btrfs: extract chunk tree read code into its own init/exit helpers Qu Wenruo
2022-10-12  9:13 ` [PATCH v2 08/15] btrfs: extract tree roots and zone info initialization into " Qu Wenruo
2022-10-12  9:13 ` [PATCH v2 09/15] btrfs: extract mount time checks and items load code into its init helper Qu Wenruo
2022-10-12  9:13 ` [PATCH v2 10/15] btrfs: extract sysfs init into its own helper Qu Wenruo
2022-10-12  9:13 ` [PATCH v2 11/15] btrfs: extra block groups read code into its own init/exit helpers Qu Wenruo
2022-10-12  9:13 ` [PATCH v2 12/15] btrfs: move the fs root related " Qu Wenruo
2022-10-12  9:13 ` [PATCH v2 13/15] btrfs: extract kthread " Qu Wenruo
2022-10-12  9:13 ` [PATCH v2 14/15] btrfs: move qgroup init/exit code into open_ctree_seq[] array Qu Wenruo
2022-10-12  9:13 ` [PATCH v2 15/15] btrfs: introduce a debug mount option to do error injection for each stage of open_ctree() Qu Wenruo
2022-10-14 12:43   ` Josef Bacik [this message]
2022-10-14 23:04     ` Qu Wenruo
2022-10-24 13:47 ` [PATCH v2 00/15] btrfs: make open_ctree() init/exit sequence strictly matched David Sterba
2022-10-24 23:02   ` Qu Wenruo

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=Y0lZbFnapZ6Z3Xcv@localhost.localdomain \
    --to=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /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).