linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Nikolay Borisov <nborisov@suse.com>
Cc: Qu Wenruo <quwenruo.btrfs@gmx.com>, Qu Wenruo <wqu@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/2] btrfs: replace BUG_ON() in btrfs_csum_one_bio() with proper error handling
Date: Mon, 16 Aug 2021 16:21:00 +0200	[thread overview]
Message-ID: <20210816142100.GD5047@twin.jikos.cz> (raw)
In-Reply-To: <7953dbaf-7b7a-2279-0ac0-63bb51a51f1d@suse.com>

On Mon, Aug 02, 2021 at 11:49:38AM +0300, Nikolay Borisov wrote:
> 
> 
> On 2.08.21 г. 11:03, Qu Wenruo wrote:
> > 
> > 
> > On 2021/8/2 下午3:53, Nikolay Borisov wrote:
> >>
> >>
> >> On 2.08.21 г. 9:54, Qu Wenruo wrote:
> >>> The BUG_ON() in btrfs_csum_one_bio() means we're trying to submit a bio
> >>> while we don't have ordered extent for it at all.
> >>>
> >>> Normally this won't happen and is indeed a code logical error.
> >>>
> >>> But previous fix has already shown another possibility that, some call
> >>> sites don't handle error properly and submit the write bio after its
> >>> ordered extent has already been cleaned up.
> >>>
> >>> This patch will add an extra safe net by replacing the BUG_ON() to
> >>> proper error handling.
> >>>
> >>> And even if some day we hit a regression that we're submitting bio
> >>> without an ordered extent, we will return error and the pages will be
> >>> marked Error, and being caught properly.
> >>
> >> Would this hamper debugability? I.e it will result in some writes
> >> failing with an error, right?
> > 
> > Yes, it will make such corner case way more silent than before.
> > 
> > But IMHO the existing BUG_ON() is also overkilled.
> > 
> > Maybe converting it to WARN_ON() would be a good middle land?
> 
> If this can occur only due to code bugs I'd prefer to leave it as a
> BUG_ON. Ideally this should only trigger on developer machines when
> testing code changes.

I'd rather see a WARN_ON + the error handling code, a BUG_ON will shoot
down the whole machine. In this case it's probably serious enough but
in the long run we want to get rid of BUG_ONs that can be reasonably
handled.

  reply	other threads:[~2021-08-16 14:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02  6:54 [PATCH 0/2] btrfs: fix the generic/475 crash for subpage case Qu Wenruo
2021-08-02  6:54 ` [PATCH 1/2] btrfs: don't try to flush data write bio if we hit error preparing it Qu Wenruo
2021-08-02  6:54 ` [PATCH 2/2] btrfs: replace BUG_ON() in btrfs_csum_one_bio() with proper error handling Qu Wenruo
2021-08-02  7:53   ` Nikolay Borisov
2021-08-02  8:03     ` Qu Wenruo
2021-08-02  8:49       ` Nikolay Borisov
2021-08-16 14:21         ` David Sterba [this message]
2021-08-16 23:30           ` Qu Wenruo
2021-08-03  5:31 ` [PATCH 0/2] btrfs: fix the generic/475 crash for subpage case 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=20210816142100.GD5047@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=quwenruo.btrfs@gmx.com \
    --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).