* [PATCH 5/5] Btrfs: fix memory leak in btrfs_pause_balance()
@ 2012-05-17 11:58 Miao Xie
2012-05-17 15:20 ` Ilya Dryomov
0 siblings, 1 reply; 3+ messages in thread
From: Miao Xie @ 2012-05-17 11:58 UTC (permalink / raw)
To: Linux Btrfs
We forget to free fs_info->balance_ctl in the btrfs_pause_balance()
when umounting the fs.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
---
fs/btrfs/volumes.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c536d52..fd7fe80 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2937,6 +2937,9 @@ int btrfs_pause_balance(struct btrfs_fs_info *fs_info)
ret = -ENOTCONN;
}
+ if (btrfs_fs_closing(fs_info) && fs_info->balance_ctl)
+ unset_balance_control(fs_info);
+
mutex_unlock(&fs_info->balance_mutex);
return ret;
}
--
1.7.6.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 5/5] Btrfs: fix memory leak in btrfs_pause_balance()
2012-05-17 11:58 [PATCH 5/5] Btrfs: fix memory leak in btrfs_pause_balance() Miao Xie
@ 2012-05-17 15:20 ` Ilya Dryomov
2012-05-18 3:12 ` Miao Xie
0 siblings, 1 reply; 3+ messages in thread
From: Ilya Dryomov @ 2012-05-17 15:20 UTC (permalink / raw)
To: Miao Xie; +Cc: Linux Btrfs
On Thu, May 17, 2012 at 07:58:53PM +0800, Miao Xie wrote:
> We forget to free fs_info->balance_ctl in the btrfs_pause_balance()
> when umounting the fs.
>
> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
> ---
> fs/btrfs/volumes.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index c536d52..fd7fe80 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -2937,6 +2937,9 @@ int btrfs_pause_balance(struct btrfs_fs_info *fs_info)
> ret = -ENOTCONN;
> }
>
> + if (btrfs_fs_closing(fs_info) && fs_info->balance_ctl)
> + unset_balance_control(fs_info);
> +
> mutex_unlock(&fs_info->balance_mutex);
> return ret;
> }
It is kfree()'d in free_fs_info(), which should be called on unmount.
Am I missing something here ?
Thanks,
Ilya
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 5/5] Btrfs: fix memory leak in btrfs_pause_balance()
2012-05-17 15:20 ` Ilya Dryomov
@ 2012-05-18 3:12 ` Miao Xie
0 siblings, 0 replies; 3+ messages in thread
From: Miao Xie @ 2012-05-18 3:12 UTC (permalink / raw)
To: Ilya Dryomov; +Cc: Linux Btrfs
On thu, 17 May 2012 18:20:04 +0300, Ilya Dryomov wrote:
> On Thu, May 17, 2012 at 07:58:53PM +0800, Miao Xie wrote:
>> We forget to free fs_info->balance_ctl in the btrfs_pause_balance()
>> when umounting the fs.
>>
>> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
>> ---
>> fs/btrfs/volumes.c | 3 +++
>> 1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>> index c536d52..fd7fe80 100644
>> --- a/fs/btrfs/volumes.c
>> +++ b/fs/btrfs/volumes.c
>> @@ -2937,6 +2937,9 @@ int btrfs_pause_balance(struct btrfs_fs_info *fs_info)
>> ret = -ENOTCONN;
>> }
>>
>> + if (btrfs_fs_closing(fs_info) && fs_info->balance_ctl)
>> + unset_balance_control(fs_info);
>> +
>> mutex_unlock(&fs_info->balance_mutex);
>> return ret;
>> }
>
> It is kfree()'d in free_fs_info(), which should be called on unmount.
> Am I missing something here ?
It is my mistake. Sorry.
BTW I think freeing it in btrfs_pause_balance() is better because it is relative
to the balance, or the readability will become worse.
Thanks
Miao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-18 3:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-17 11:58 [PATCH 5/5] Btrfs: fix memory leak in btrfs_pause_balance() Miao Xie
2012-05-17 15:20 ` Ilya Dryomov
2012-05-18 3:12 ` Miao Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).