Skip to content

Commit

Permalink
NFSv2/v3: Fix a memory leak when using -onolock
Browse files Browse the repository at this point in the history
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 <Trond.Myklebust@netapp.com>
Acked-by: NeilBrown <neilb@suse.de>
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Dec 12, 2007
1 parent 4584f52 commit 5cef338
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/nfs/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,6 @@ static int nfs_create_rpc_client(struct nfs_client *clp, int proto,
*/
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 */
}
Expand Down Expand Up @@ -755,6 +752,9 @@ void nfs_free_server(struct nfs_server *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);

Expand Down

0 comments on commit 5cef338

Please sign in to comment.