diff mbox

[2/3] Btrfs: catch error return value from find_extent_in_eb()

Message ID 1375938259-5015-2-git-send-email-wangsl.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wang Shilong Aug. 8, 2013, 5:04 a.m. UTC
find_extent_in_eb() may return ENOMEM, catch this error return value.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
---
 fs/btrfs/backref.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Filipe Manana Aug. 8, 2013, 10:24 a.m. UTC | #1
On Thu, Aug 8, 2013 at 6:04 AM, Wang Shilong <wangsl.fnst@cn.fujitsu.com> wrote:
> find_extent_in_eb() may return ENOMEM, catch this error return value.
>
> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
> Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
>  fs/btrfs/backref.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
> index 54e7610..f7781e6 100644
> --- a/fs/btrfs/backref.c
> +++ b/fs/btrfs/backref.c
> @@ -934,6 +934,10 @@ again:
>                                 }
>                                 ret = find_extent_in_eb(eb, bytenr,
>                                                         *extent_item_pos, &eie);
> +                               if (ret) {
> +                                       free_extent_buffer(eb);
> +                                       goto out;
> +                               }
>                                 ref->inode_list = eie;
>                                 free_extent_buffer(eb);
>                         }

Hello, this is a duplicate of:  https://patchwork.kernel.org/patch/2835989/

thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wang Shilong Aug. 8, 2013, 11:01 a.m. UTC | #2
On 08/08/2013 06:24 PM, Filipe David Manana wrote:
> On Thu, Aug 8, 2013 at 6:04 AM, Wang Shilong <wangsl.fnst@cn.fujitsu.com> wrote:
>> find_extent_in_eb() may return ENOMEM, catch this error return value.
>>
>> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
>> Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
>> ---
>>  fs/btrfs/backref.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
>> index 54e7610..f7781e6 100644
>> --- a/fs/btrfs/backref.c
>> +++ b/fs/btrfs/backref.c
>> @@ -934,6 +934,10 @@ again:
>>                                 }
>>                                 ret = find_extent_in_eb(eb, bytenr,
>>                                                         *extent_item_pos, &eie);
>> +                               if (ret) {
>> +                                       free_extent_buffer(eb);
>> +                                       goto out;
>> +                               }
>>                                 ref->inode_list = eie;
>>                                 free_extent_buffer(eb);
>>                         }
> 
> Hello, this is a duplicate of:  https://patchwork.kernel.org/patch/2835989/

Yeah, just ignore my patch.

Thanks,
Wang
> 
> thanks
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Schmidt Aug. 8, 2013, 11:06 a.m. UTC | #3
On Thu, August 08, 2013 at 12:24 (+0200), Filipe David Manana wrote:
> On Thu, Aug 8, 2013 at 6:04 AM, Wang Shilong <wangsl.fnst@cn.fujitsu.com> wrote:
>> find_extent_in_eb() may return ENOMEM, catch this error return value.
>>
>> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
>> Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
>> ---
>>  fs/btrfs/backref.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
>> index 54e7610..f7781e6 100644
>> --- a/fs/btrfs/backref.c
>> +++ b/fs/btrfs/backref.c
>> @@ -934,6 +934,10 @@ again:
>>                                 }
>>                                 ret = find_extent_in_eb(eb, bytenr,
>>                                                         *extent_item_pos, &eie);
>> +                               if (ret) {
>> +                                       free_extent_buffer(eb);
>> +                                       goto out;
>> +                               }
>>                                 ref->inode_list = eie;
>>                                 free_extent_buffer(eb);
>>                         }
> 
> Hello, this is a duplicate of:  https://patchwork.kernel.org/patch/2835989/

Your linked patch checks for ret < 0, which is a safer option since there are
functions down the stack returning > 0 or 0 for success and < 0 for errors.
Currently, find_extent_in_eb doesn't return their return values, but I'd rather
be a bit more on the safe side and use your patch.

Thanks,
-Jan
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index 54e7610..f7781e6 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -934,6 +934,10 @@  again:
 				}
 				ret = find_extent_in_eb(eb, bytenr,
 							*extent_item_pos, &eie);
+				if (ret) {
+					free_extent_buffer(eb);
+					goto out;
+				}
 				ref->inode_list = eie;
 				free_extent_buffer(eb);
 			}