All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Burkov <boris@bur.io>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 7/8] btrfs: do not try to repair bio that has no mirror set
Date: Fri, 11 Feb 2022 14:56:12 -0800	[thread overview]
Message-ID: <YgbpjLm1MBTD7lah@zen> (raw)
In-Reply-To: <531eb09d460d686e75e96f0ebafde78c670d84fe.1644532798.git.josef@toxicpanda.com>

On Thu, Feb 10, 2022 at 05:44:25PM -0500, Josef Bacik wrote:
> If we fail to submit a bio for whatever reason, we may not have setup a
> mirror_num for that bio.  This means we shouldn't try to do the repair
> workflow, if we do we'll hit an BUG_ON(!failrec->this_mirror) in
> clean_io_failure.  Instead simply skip the repair workflow if we have no
> mirror set, and add an assert to btrfs_check_repairable() to make it
> easier to catch what is happening in the future.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Boris Burkov <boris@bur.io>
> ---
>  fs/btrfs/extent_io.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index bda7fa8cf540..29ffb2814e5c 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -2610,6 +2610,7 @@ static bool btrfs_check_repairable(struct inode *inode,
>  	 * a good copy of the failed sector and if we succeed, we have setup
>  	 * everything for repair_io_failure to do the rest for us.
>  	 */
> +	ASSERT(failed_mirror);
>  	failrec->failed_mirror = failed_mirror;
>  	failrec->this_mirror++;
>  	if (failrec->this_mirror == failed_mirror)
> @@ -3067,6 +3068,14 @@ static void end_bio_extent_readpage(struct bio *bio)
>  			goto readpage_ok;
>  
>  		if (is_data_inode(inode)) {
> +			/*
> +			 * If we failed to submit the IO at all we'll have a
> +			 * mirror_num == 0, in which case we need to just mark
> +			 * the page with an error and unlock it and carry on.
> +			 */
> +			if (mirror == 0)
> +				goto readpage_ok;
> +
>  			/*
>  			 * btrfs_submit_read_repair() will handle all the good
>  			 * and bad sectors, we just continue to the next bvec.
> -- 
> 2.26.3
> 

  reply	other threads:[~2022-02-11 22:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 22:44 [PATCH 0/8] Fix error handling on data bio submission Josef Bacik
2022-02-10 22:44 ` [PATCH 1/8] btrfs: make search_csum_tree return 0 if we get -EFBIG Josef Bacik
2022-02-11 22:39   ` Boris Burkov
2022-02-15 16:10   ` Johannes Thumshirn
2022-02-10 22:44 ` [PATCH 2/8] btrfs: handle csum lookup errors properly on reads Josef Bacik
2022-02-11 22:28   ` Boris Burkov
2022-02-10 22:44 ` [PATCH 3/8] btrfs: check correct bio in finish_compressed_bio_read Josef Bacik
2022-02-11 22:43   ` Boris Burkov
2022-02-16  8:48   ` Johannes Thumshirn
2022-02-10 22:44 ` [PATCH 4/8] btrfs: remove the bio argument from finish_compressed_bio_read Josef Bacik
2022-02-16  8:50   ` Johannes Thumshirn
2022-02-10 22:44 ` [PATCH 5/8] btrfs: track compressed bio errors as blk_status_t Josef Bacik
2022-02-16  8:53   ` Johannes Thumshirn
2022-02-10 22:44 ` [PATCH 6/8] btrfs: do not double complete bio on errors during compressed reads Josef Bacik
2022-02-11 22:54   ` Boris Burkov
2022-02-14 17:06     ` David Sterba
2022-02-10 22:44 ` [PATCH 7/8] btrfs: do not try to repair bio that has no mirror set Josef Bacik
2022-02-11 22:56   ` Boris Burkov [this message]
2022-02-10 22:44 ` [PATCH 8/8] btrfs: do not clean up repair bio if submit fails Josef Bacik
2022-02-11 23:00   ` Boris Burkov

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=YgbpjLm1MBTD7lah@zen \
    --to=boris@bur.io \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.