All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>, Qu Wenruo <wqu@suse.de>,
	dsterba@suse.cz, linux-btrfs@vger.kernel.org,
	Josef Bacik <josef@toxicpanda.com>
Subject: Re: [PATCH] btrfs: extent_io: Handle memory allocation failure in __clear_extent_bit()
Date: Thu, 18 Apr 2019 15:27:19 +0300	[thread overview]
Message-ID: <156a2901-a5e9-7ba4-1712-42a4bd4dff8a@suse.com> (raw)
In-Reply-To: <a7d7c706-6e42-21bb-c42d-c60529bcd946@gmx.com>



On 18.04.19 г. 14:54 ч., Qu Wenruo wrote:
<snip>

> 
> Forgot to mention, for that method, I'll definitely keep the BUG_ON() on
> @prealloc.
> 
> Just make the allocation part fall back to use fs_info->last_chance[] to
> grab a valid memory slot.

Before you go and re-invent the wheel I will suggest you take a look at
the mempool api (include/linux/mempool.h). AFAIK it's purpose is to
exactly ensure memory allocations from it will not fail (depending on
how the pool is configured)

> 
> Thanks,
> Qu
> 
>>
>> The main reason I'm doing such error injection test is to ensure write
>> time tree checker is not the cause of the lockup.
>>
>> Of course I can directly inject error into btrfs_check_leaf_full() and
>> btrfs_check_node(), and filter the stack to ensure it only happen in
>> write time, and that's already what I'm crafting, based on the bcc error
>> inject example and kprobe return value overriding.
>>
>> But it will never be a bad idea to explore what can go wrong.
>> And "always BUG_ON()" -> "good enough (TM)" already looks like a
>> improvement to me.
>>
>> Thanks,
>> Qu
>>
> 

  reply	other threads:[~2019-04-18 12:27 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 [this message]
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

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=156a2901-a5e9-7ba4-1712-42a4bd4dff8a@suse.com \
    --to=nborisov@suse.com \
    --cc=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=wqu@suse.de \
    /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.