diff mbox

nfs/flexfiles: fix leak of nfs4_ff_ds_version arrays

Message ID 20170801202501.4876-1-dros@primarydata.com (mailing list archive)
State New, archived
Headers show

Commit Message

Weston Andros Adamson Aug. 1, 2017, 8:25 p.m. UTC
The client was freeing the nfs4_ff_layout_ds, but not the contained
nfs4_ff_ds_version array.

Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
---
 fs/nfs/flexfilelayout/flexfilelayoutdev.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Weston Andros Adamson Aug. 3, 2017, 2:07 a.m. UTC | #1
This should probably be CCed to some stable releases too. I'll figure it out soon.

-dros

> On Aug 1, 2017, at 4:25 PM, Weston Andros Adamson <dros@monkey.org> wrote:
> 
> The client was freeing the nfs4_ff_layout_ds, but not the contained
> nfs4_ff_ds_version array.
> 
> Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
> ---
> fs/nfs/flexfilelayout/flexfilelayoutdev.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
> index 6df7a0cf5660..f32c58bbe556 100644
> --- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
> +++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
> @@ -32,6 +32,7 @@ void nfs4_ff_layout_free_deviceid(struct nfs4_ff_layout_ds *mirror_ds)
> {
> 	nfs4_print_deviceid(&mirror_ds->id_node.deviceid);
> 	nfs4_pnfs_ds_put(mirror_ds->ds);
> +	kfree(mirror_ds->ds_versions);
> 	kfree_rcu(mirror_ds, id_node.rcu);
> }
> 
> -- 
> 2.11.0 (Apple Git-81)
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mkrtchyan, Tigran Aug. 3, 2017, 12:57 p.m. UTC | #2
Hi Dros,

can this leak be the source of issue described here:  http://www.spinics.net/lists/linux-nfs/msg64890.html

Tigran.

----- Original Message -----
> From: "Weston Andros Adamson" <dros@monkey.org>
> To: "Trond Myklebust" <trond.myklebust@primarydata.com>, "Anna Schumaker" <anna.schumaker@netapp.com>
> Cc: "linux-nfs" <linux-nfs@vger.kernel.org>
> Sent: Thursday, August 3, 2017 4:07:28 AM
> Subject: Re: [PATCH] nfs/flexfiles: fix leak of nfs4_ff_ds_version arrays

> This should probably be CCed to some stable releases too. I'll figure it out
> soon.
> 
> -dros
> 
>> On Aug 1, 2017, at 4:25 PM, Weston Andros Adamson <dros@monkey.org> wrote:
>> 
>> The client was freeing the nfs4_ff_layout_ds, but not the contained
>> nfs4_ff_ds_version array.
>> 
>> Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
>> ---
>> fs/nfs/flexfilelayout/flexfilelayoutdev.c | 1 +
>> 1 file changed, 1 insertion(+)
>> 
>> diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
>> b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
>> index 6df7a0cf5660..f32c58bbe556 100644
>> --- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
>> +++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
>> @@ -32,6 +32,7 @@ void nfs4_ff_layout_free_deviceid(struct nfs4_ff_layout_ds
>> *mirror_ds)
>> {
>> 	nfs4_print_deviceid(&mirror_ds->id_node.deviceid);
>> 	nfs4_pnfs_ds_put(mirror_ds->ds);
>> +	kfree(mirror_ds->ds_versions);
>> 	kfree_rcu(mirror_ds, id_node.rcu);
>> }
>> 
>> --
>> 2.11.0 (Apple Git-81)
>> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Weston Andros Adamson Aug. 11, 2017, 2:18 p.m. UTC | #3
Hey Tigran,

I don't think so, this fixes a simple memory leak where memory is not freed and nothing holds a reference to it. It should not lead to any invalid pointers, but will eventually lead to the OOM killer killing a bunch of processes.

There have been other recent changes that may have addressed this. Can you reproduce with the latest changes?

-dros

> On Aug 3, 2017, at 8:57 AM, Mkrtchyan, Tigran <tigran.mkrtchyan@desy.de> wrote:
> 
> Hi Dros,
> 
> can this leak be the source of issue described here:  http://www.spinics.net/lists/linux-nfs/msg64890.html
> 
> Tigran.
> 
> ----- Original Message -----
>> From: "Weston Andros Adamson" <dros@monkey.org>
>> To: "Trond Myklebust" <trond.myklebust@primarydata.com>, "Anna Schumaker" <anna.schumaker@netapp.com>
>> Cc: "linux-nfs" <linux-nfs@vger.kernel.org>
>> Sent: Thursday, August 3, 2017 4:07:28 AM
>> Subject: Re: [PATCH] nfs/flexfiles: fix leak of nfs4_ff_ds_version arrays
> 
>> This should probably be CCed to some stable releases too. I'll figure it out
>> soon.
>> 
>> -dros
>> 
>>> On Aug 1, 2017, at 4:25 PM, Weston Andros Adamson <dros@monkey.org> wrote:
>>> 
>>> The client was freeing the nfs4_ff_layout_ds, but not the contained
>>> nfs4_ff_ds_version array.
>>> 
>>> Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
>>> ---
>>> fs/nfs/flexfilelayout/flexfilelayoutdev.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>> 
>>> diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
>>> b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
>>> index 6df7a0cf5660..f32c58bbe556 100644
>>> --- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
>>> +++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
>>> @@ -32,6 +32,7 @@ void nfs4_ff_layout_free_deviceid(struct nfs4_ff_layout_ds
>>> *mirror_ds)
>>> {
>>> 	nfs4_print_deviceid(&mirror_ds->id_node.deviceid);
>>> 	nfs4_pnfs_ds_put(mirror_ds->ds);
>>> +	kfree(mirror_ds->ds_versions);
>>> 	kfree_rcu(mirror_ds, id_node.rcu);
>>> }
>>> 
>>> --
>>> 2.11.0 (Apple Git-81)
>>> 
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" 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/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
index 6df7a0cf5660..f32c58bbe556 100644
--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
@@ -32,6 +32,7 @@  void nfs4_ff_layout_free_deviceid(struct nfs4_ff_layout_ds *mirror_ds)
 {
 	nfs4_print_deviceid(&mirror_ds->id_node.deviceid);
 	nfs4_pnfs_ds_put(mirror_ds->ds);
+	kfree(mirror_ds->ds_versions);
 	kfree_rcu(mirror_ds, id_node.rcu);
 }