diff mbox series

btrfs: qgroup: Fix inconsistent IS_ERR and PTR_ERR

Message ID 20190131023016.GA3413@embeddedor (mailing list archive)
State New, archived
Headers show
Series btrfs: qgroup: Fix inconsistent IS_ERR and PTR_ERR | expand

Commit Message

Gustavo A. R. Silva Jan. 31, 2019, 2:30 a.m. UTC
Fix inconsistent IS_ERR and PTR_ERR in btrfs_qgroup_trace_subtree_after_cow

The proper pointer to be passed as argument is reloc_eb.

This bug was detected with the help of Coccinelle.

Fixes: 2b35a512e9cf ("btrfs: qgroup: Use delayed subtree rescan for balance")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 fs/btrfs/qgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Sterba Jan. 31, 2019, 11:49 a.m. UTC | #1
On Wed, Jan 30, 2019 at 08:30:16PM -0600, Gustavo A. R. Silva wrote:
> Fix inconsistent IS_ERR and PTR_ERR in btrfs_qgroup_trace_subtree_after_cow
> 
> The proper pointer to be passed as argument is reloc_eb.
> 
> This bug was detected with the help of Coccinelle.
> 
> Fixes: 2b35a512e9cf ("btrfs: qgroup: Use delayed subtree rescan for balance")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  fs/btrfs/qgroup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
> index 8559ed92d708..16d7ec8e4a06 100644
> --- a/fs/btrfs/qgroup.c
> +++ b/fs/btrfs/qgroup.c
> @@ -3931,7 +3931,7 @@ int btrfs_qgroup_trace_subtree_after_cow(struct btrfs_trans_handle *trans,
>  				   block->reloc_generation, block->level,
>  				   &block->first_key);
>  	if (IS_ERR(reloc_eb)) {
> -		ret = PTR_ERR(subv_eb);
> +		ret = PTR_ERR(reloc_eb);

Thanks, this was reported and fixed but the change has not propagated to
for-next yet.
Gustavo A. R. Silva Jan. 31, 2019, 10:09 p.m. UTC | #2
On 1/31/19 5:49 AM, David Sterba wrote:
> On Wed, Jan 30, 2019 at 08:30:16PM -0600, Gustavo A. R. Silva wrote:
>> Fix inconsistent IS_ERR and PTR_ERR in btrfs_qgroup_trace_subtree_after_cow
>>
>> The proper pointer to be passed as argument is reloc_eb.
>>
>> This bug was detected with the help of Coccinelle.
>>
>> Fixes: 2b35a512e9cf ("btrfs: qgroup: Use delayed subtree rescan for balance")
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>> ---
>>  fs/btrfs/qgroup.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
>> index 8559ed92d708..16d7ec8e4a06 100644
>> --- a/fs/btrfs/qgroup.c
>> +++ b/fs/btrfs/qgroup.c
>> @@ -3931,7 +3931,7 @@ int btrfs_qgroup_trace_subtree_after_cow(struct btrfs_trans_handle *trans,
>>  				   block->reloc_generation, block->level,
>>  				   &block->first_key);
>>  	if (IS_ERR(reloc_eb)) {
>> -		ret = PTR_ERR(subv_eb);
>> +		ret = PTR_ERR(reloc_eb);
> 
> Thanks, this was reported and fixed but the change has not propagated to
> for-next yet.
> 

Great. Good to know it is fixed now.

Thanks
--
Gustavo
diff mbox series

Patch

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 8559ed92d708..16d7ec8e4a06 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -3931,7 +3931,7 @@  int btrfs_qgroup_trace_subtree_after_cow(struct btrfs_trans_handle *trans,
 				   block->reloc_generation, block->level,
 				   &block->first_key);
 	if (IS_ERR(reloc_eb)) {
-		ret = PTR_ERR(subv_eb);
+		ret = PTR_ERR(reloc_eb);
 		reloc_eb = NULL;
 		goto free_out;
 	}