diff mbox series

[02/38] btrfs-progs: remove useless add_root_to_dirty_list call in mkfs

Message ID 34ac8f222d475d692faa8d325cf63b5196912644.1692800904.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: sync ctree.c into btrfs-progs | expand

Commit Message

Josef Bacik Aug. 23, 2023, 2:32 p.m. UTC
We are calling this when creating the UUID tree, however when we create
the tree it inserts the root item into the tree_root, so this call is
superfluous.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 mkfs/main.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Qu Wenruo Aug. 29, 2023, 6:32 a.m. UTC | #1
On 2023/8/23 22:32, Josef Bacik wrote:
> We are calling this when creating the UUID tree, however when we create
> the tree it inserts the root item into the tree_root, so this call is
> superfluous.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Unfortunately this patch is causing extent buffer leakage. (Thanks Anand
for finding it)

The latest devel branch would cause two eb leaks, one for uuid tree
(caused by this one), another eb would be from free space tree.

We can remove this one, but we need to add those dirty trees to dirty
cowonly tree lists at least in btrfs_create_tree().

Unfortunately this means we still need to export
add_root_to_dirty_list(), and would cause conflicts with later patches.

Thanks,
Qu
> ---
>   mkfs/main.c | 1 -
>   1 file changed, 1 deletion(-)
>
> diff --git a/mkfs/main.c b/mkfs/main.c
> index 1c5d668e..1b917f55 100644
> --- a/mkfs/main.c
> +++ b/mkfs/main.c
> @@ -789,7 +789,6 @@ static int create_uuid_tree(struct btrfs_trans_handle *trans)
>   		goto out;
>   	}
>
> -	add_root_to_dirty_list(root);
>   	fs_info->uuid_root = root;
>   	ret = btrfs_uuid_tree_add(trans, fs_info->fs_root->root_item.uuid,
>   				  BTRFS_UUID_KEY_SUBVOL,
Qu Wenruo Aug. 29, 2023, 6:42 a.m. UTC | #2
On 2023/8/29 14:32, Qu Wenruo wrote:
>
>
> On 2023/8/23 22:32, Josef Bacik wrote:
>> We are calling this when creating the UUID tree, however when we create
>> the tree it inserts the root item into the tree_root, so this call is
>> superfluous.
>>
>> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
>
> Unfortunately this patch is causing extent buffer leakage. (Thanks Anand
> for finding it)
>
> The latest devel branch would cause two eb leaks, one for uuid tree
> (caused by this one), another eb would be from free space tree.

My bad, the other one is from data reloc tree, not free space tree.

Thanks,
Qu

>
> We can remove this one, but we need to add those dirty trees to dirty
> cowonly tree lists at least in btrfs_create_tree().
>
> Unfortunately this means we still need to export
> add_root_to_dirty_list(), and would cause conflicts with later patches.
>
> Thanks,
> Qu
>> ---
>>   mkfs/main.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/mkfs/main.c b/mkfs/main.c
>> index 1c5d668e..1b917f55 100644
>> --- a/mkfs/main.c
>> +++ b/mkfs/main.c
>> @@ -789,7 +789,6 @@ static int create_uuid_tree(struct
>> btrfs_trans_handle *trans)
>>           goto out;
>>       }
>>
>> -    add_root_to_dirty_list(root);
>>       fs_info->uuid_root = root;
>>       ret = btrfs_uuid_tree_add(trans, fs_info->fs_root->root_item.uuid,
>>                     BTRFS_UUID_KEY_SUBVOL,
diff mbox series

Patch

diff --git a/mkfs/main.c b/mkfs/main.c
index 1c5d668e..1b917f55 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -789,7 +789,6 @@  static int create_uuid_tree(struct btrfs_trans_handle *trans)
 		goto out;
 	}
 
-	add_root_to_dirty_list(root);
 	fs_info->uuid_root = root;
 	ret = btrfs_uuid_tree_add(trans, fs_info->fs_root->root_item.uuid,
 				  BTRFS_UUID_KEY_SUBVOL,