From: Cong Wang <amwang@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Jens Axboe <jens.axboe@oracle.com>, Nick Piggin <npiggin@suse.de>,
linux-fsdevel@vger.kernel.org, "Theodore Ts'o" <tytso@mit.edu>
Subject: Re: [Patch] fs: remove a useless BUG()
Date: Tue, 08 Dec 2009 18:13:32 +0800 [thread overview]
Message-ID: <4B1E26CC.1090009@redhat.com> (raw)
In-Reply-To: <20091202141458.66b5f069.akpm@linux-foundation.org>
Andrew Morton wrote:
> On Mon, 30 Nov 2009 21:34:14 -0500
> Amerigo Wang <amwang@redhat.com> wrote:
>
>> This BUG() is suspicious, it makes its following statements
>> unreachable, and it seems to be useless, since the caller
>> of this function already handles the failure properly.
>> Remove it.
>>
>> Signed-off-by: WANG Cong <amwang@redhat.com>
>> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
>> Cc: Jens Axboe <jens.axboe@oracle.com>
>> Cc: Nick Piggin <npiggin@suse.de>
>> Cc: "Theodore Ts'o" <tytso@mit.edu>
>>
>> ---
>> diff --git a/fs/buffer.c b/fs/buffer.c
>> index 6fa5302..ac111d7 100644
>> --- a/fs/buffer.c
>> +++ b/fs/buffer.c
>> @@ -1041,7 +1041,6 @@ grow_dev_page(struct block_device *bdev, sector_t block,
>> return page;
>>
>> failed:
>> - BUG();
>> unlock_page(page);
>> page_cache_release(page);
>> return NULL;
>
> The caller doesn't handle this properly. If we return zero here,
> grow_buffers() will say sheesh and will retry and the kernel goes into
> an infinite retry loop.
>
> If there is a blockdev page which is sitting in pagecache and for some
> reason it has buffers and we cannot release them, we're kind of stuck
> and don't know what to do. Going BUG() is a decent thing to do here.
>
> I don't think I've ever seen a report of the BUG triggering. It could
> happen as a result of memory corruption or a missed bh_put() or
> whatever.
>
Oh, good explanation!
> I think a better patch would be to remove the
> unlock_page()/page_cache_release(), add a comment (culled from the
> above) and leave the BUG() there.
>
Ok, I will prepare a patch tomorrow.
Thanks!
prev parent reply other threads:[~2009-12-08 10:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-01 2:34 [Patch] fs: remove a useless BUG() Amerigo Wang
2009-12-01 16:55 ` Marcin Slusarz
2009-12-01 18:52 ` tytso
2009-12-02 8:52 ` Nick Piggin
2009-12-02 22:14 ` Andrew Morton
2009-12-08 10:13 ` Cong Wang [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=4B1E26CC.1090009@redhat.com \
--to=amwang@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=jens.axboe@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/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).