Re: [Patch] fs: remove a useless BUG()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 30 Nov 2009 21:34:14 -0500
Amerigo Wang <amwang@xxxxxxxxxx> 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@xxxxxxxxxx>
> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
> Cc: Jens Axboe <jens.axboe@xxxxxxxxxx>
> Cc: Nick Piggin <npiggin@xxxxxxx>
> Cc: "Theodore Ts'o" <tytso@xxxxxxx>
> 
> ---
> 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.

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.

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux