lkml.org 
[lkml]   [2013]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] Btrfs: cleanup redundant code in __btrfs_close_devices()
From
On Mon, Sep 9, 2013 at 7:28 AM, Wang Shilong <wangsl.fnst@cn.fujitsu.com> wrote:
> On 09/08/2013 12:15 AM, Azat Khuzhin wrote:
>>
>> Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
>> ---
>> fs/btrfs/volumes.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index 1d1b595..124228e 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -644,7 +644,7 @@ static int __btrfs_close_devices(struct
>> btrfs_fs_devices *fs_devices)
>> /* Safe because we are under uuid_mutex */
>> if (device->name) {
>> name = rcu_string_strdup(device->name->str,
>> GFP_NOFS);
>> - BUG_ON(device->name && !name); /* -ENOMEM */
>> + BUG_ON(!name); /* -ENOMEM *
>
> Nice catch! out of memory should not trigger BUG_ON()..
> Maybe we can handle it gracefully.

Maybe return -ENOMEM ?

>
> Thanks,
> Wang
>
>> rcu_assign_pointer(new_device->name, name);
>> }
>> new_device->bdev = NULL;
>
>



--
Respectfully
Azat Khuzhin


\
 
 \ /
  Last update: 2013-09-10 14:01    [W:0.053 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site