linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.de>
To: Josef Bacik <josef@toxicpanda.com>, Nikolay Borisov <nborisov@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: extent_io: Handle memory allocation failure in __clear_extent_bit()
Date: Thu, 18 Apr 2019 22:15:24 +0800	[thread overview]
Message-ID: <dfaae7d9-4e80-89f3-8b91-58907dbb7662@suse.de> (raw)
In-Reply-To: <20190418141049.gazrt4nw7ynlqayl@macbook-pro-91.dhcp.thefacebook.com>



On 2019/4/18 下午10:10, Josef Bacik wrote:
> On Thu, Apr 18, 2019 at 10:24:10AM +0300, Nikolay Borisov wrote:
>>
>>
>> On 18.04.19 г. 10:21 ч., Qu Wenruo wrote:
>>> There is a BUG_ON() in __clear_extent_bit() for memory allocation
>>> failure.
>>>
>>> While comment of __clear_extent_bit() says it can return error, but we
>>> always return 0.
>>>
>>> Some __clear_extent_bit() callers just ignore the return value, while
>>> some still expect error.
>>>
>>> Let's return proper error for this memory allocation anyway, to remove
>>> that BUG_ON() as a first step, so at least we can continue test.
>>
>> I remember Josef did some changes into this code and said that prealloc
>> shouldn't fail because this will cause mayhem down the road i.e. proper
>> error handling is missing. If anything I think it should be added first
>> and then remove the BUG_ONs.
> 
> I'm ok with changing this, but it needs to be more than just one patch.  Make
> alloc_extent_state_atomic() error injectable and then use either error-inject.py
> in bcc or use
> https://github.com/josefbacik/debug-scripts/blob/master/inject-error.py to test
> it and fix all the fallout from not handling lock_extent() succeeding.

Exactly what I'm going to do. With some blend from bcc inject.py, for
stack filter to provide more precious match.

> 
> You can use https://github.com/josefbacik/debug-scripts/blob/master/codepaths.py
> to find all call sites for inject-error to make sure you are catching all the
> cases.  Thanks,

That script is awesome!

Thanks,
Qu

> 
> Josef
> 

      reply	other threads:[~2019-04-18 14:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18  7:21 [PATCH] btrfs: extent_io: Handle memory allocation failure in __clear_extent_bit() Qu Wenruo
2019-04-18  7:24 ` Nikolay Borisov
2019-04-18  7:30   ` Qu Wenruo
2019-04-18 11:38     ` David Sterba
2019-04-18 11:51       ` Qu Wenruo
2019-04-18 11:54         ` Qu Wenruo
2019-04-18 12:27           ` Nikolay Borisov
2019-04-18 12:44             ` Qu Wenruo
2019-04-22  5:44           ` Qu Wenruo
2019-04-18 14:10   ` Josef Bacik
2019-04-18 14:15     ` Qu Wenruo [this message]

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=dfaae7d9-4e80-89f3-8b91-58907dbb7662@suse.de \
    --to=wqu@suse.de \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@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).