2008-02-07 20:09:25

by Oliver Pinter

[permalink] [raw]
Subject: [2.6.22.y] {13/14} - NFSv2/v3: Fix a memory leak when using -onolock - on top of 2.6.22.17

aka: nfs-unmount-leak.patch

From: Trond Myklebust <[email protected]>
Date: Tue Dec 11 11:05:19 2007 -0500
Subject: NFSv2/v3: Fix a memory leak when using -onolock
Patch-mainline: 2.6.24
References: 336253

mainline: 13ef7b69b54aa8ae4ed264d0bf41339737f8543a

Neil Brown said:
> Hi Trond,
>
> We found that a machine which made moderately heavy use of
> 'automount' was leaking some nfs data structures - particularly the
> 4K allocated by rpc_alloc_iostats.
> It turns out that this only happens with filesystems with -onolock
> set.

> The problem is that if NFS_MOUNT_NONLM is set, nfs_start_lockd doesn't
> set server->destroy, so when the filesystem is unmounted, the
> ->client_acl is not shutdown, and so several resources are still
> held. Multiple mount/umount cycles will slowly eat away memory
> several pages at a time.

Signed-off-by: Trond Myklebust <[email protected]>

Acked-by: Neil Brown <[email protected]>
Signed-off-by: Neil Brown <[email protected]>
CC: Oliver Pinter <[email protected]>

---
fs/nfs/client.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

--- linux-2.6.22-SL103_BRANCH.orig/fs/nfs/client.c
+++ linux-2.6.22-SL103_BRANCH/fs/nfs/client.c
@@ -433,9 +433,6 @@ static int nfs_create_rpc_client(struct
*/
static void nfs_destroy_server(struct nfs_server *server)
{
- if (!IS_ERR(server->client_acl))
- rpc_shutdown_client(server->client_acl);
-
if (!(server->flags & NFS_MOUNT_NONLM))
lockd_down(); /* release rpc.lockd */
}
@@ -771,6 +768,9 @@ void nfs_free_server(struct nfs_server *

if (server->destroy != NULL)
server->destroy(server);
+
+ if (!IS_ERR(server->client_acl))
+ rpc_shutdown_client(server->client_acl);
if (!IS_ERR(server->client))
rpc_shutdown_client(server->client);



--
Thanks,
Oliver


2008-02-22 20:14:55

by Greg KH

[permalink] [raw]
Subject: Re: [stable] [2.6.22.y] {13/14} - NFSv2/v3: Fix a memory leak when using -onolock - on top of 2.6.22.17

On Thu, Feb 07, 2008 at 09:03:52PM +0100, Oliver Pinter wrote:
> aka: nfs-unmount-leak.patch
>
> From: Trond Myklebust <[email protected]>
> Date: Tue Dec 11 11:05:19 2007 -0500
> Subject: NFSv2/v3: Fix a memory leak when using -onolock
> Patch-mainline: 2.6.24
> References: 336253
>
> mainline: 13ef7b69b54aa8ae4ed264d0bf41339737f8543a

No, that's the wrong commit id. Please be more careful next time, it's
no fun having to verify every id to make sure that I can trust these
patches...

It's 5cef338b30c110daf547fb13d99f0c77f2a79fbc just for future reference.

thanks,

greg k-h

2008-02-22 20:26:46

by Oliver Pinter

[permalink] [raw]
Subject: Re: [stable] [2.6.22.y] {13/14} - NFSv2/v3: Fix a memory leak when using -onolock - on top of 2.6.22.17

On 2/22/08, Greg KH <[email protected]> wrote:
> On Thu, Feb 07, 2008 at 09:03:52PM +0100, Oliver Pinter wrote:
> > aka: nfs-unmount-leak.patch
> >
> > From: Trond Myklebust <[email protected]>
> > Date: Tue Dec 11 11:05:19 2007 -0500
> > Subject: NFSv2/v3: Fix a memory leak when using -onolock
> > Patch-mainline: 2.6.24
> > References: 336253
> >
> > mainline: 13ef7b69b54aa8ae4ed264d0bf41339737f8543a
>
> No, that's the wrong commit id. Please be more careful next time, it's
> no fun having to verify every id to make sure that I can trust these
> patches...

sorry, my bad, im future checked i it several time

>
> It's 5cef338b30c110daf547fb13d99f0c77f2a79fbc just for future reference.
>
> thanks,
>
> greg k-h
>
--
Thanks,
Oliver