NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/44625: memory exhaustion on NFS server while writing many files



On Thu, 17 Mar 2011 09:20:05 +0000 (UTC)
David Holland <dholland-bugs%netbsd.org@localhost> wrote:

> The following reply was made to PR kern/44625; it has been noted by GNATS.
> 
> From: David Holland <dholland-bugs%netbsd.org@localhost>
> To: gnats-bugs%NetBSD.org@localhost, Mindaugas Rasiukevicius 
> <rmind%netbsd.org@localhost>
> Cc: 
> Subject: Re: kern/44625: memory exhaustion on NFS server while writing many
>  files
> Date: Thu, 17 Mar 2011 09:18:53 +0000
> 
>  On Thu, Mar 17, 2011 at 05:35:01AM +0000, Mindaugas Rasiukevicius wrote:
>   >  > The Npage of pnbufpl grows extremely.
>   >  > 
>   >  > I also tried some kernels checked out on other date. It seems that
>   >  > this leakage is seen after struct componentname changes on Nov 30 2010.
>   >  
>   >  http://nxr.netbsd.org/xref/src/sys/nfs/nfs_serv.c?r=1.156#465
>   >  
>   >  A leak in this error path (at least)?
>  
>  good catch and boy don't I feel stupid. :-/
>  
>  This may help (not tested yet though):

I try to rsync x4 and currently it does not seem to leak.

BTW does it need to check whether nd.ni_pathbuf != NULL
at 6 lines below?

Thanks.

>  Index: nfs/nfs_serv.c
>  ===================================================================
>  RCS file: /cvsroot/src/sys/nfs/nfs_serv.c,v
>  retrieving revision 1.156
>  diff -u -p -r1.156 nfs_serv.c
>  --- nfs/nfs_serv.c   5 Feb 2011 13:35:11 -0000       1.156
>  +++ nfs/nfs_serv.c   17 Mar 2011 09:14:46 -0000
>  @@ -463,6 +463,12 @@ nfsrv_lookup(struct nfsrv_descript *nfsd
>       }
>   
>       if (error) {
>  +            if (nd.ni_pathbuf != NULL) {
>  +                    pathbuf_destroy(nd.ni_pathbuf);
>  +            }
>  +            if (ipb != NULL) {
>  +                    pathbuf_destroy(ipb);
>  +            }
>               nfsm_reply(NFSX_POSTOPATTR(v3));
>               nfsm_srvpostop_attr(dirattr_ret, &dirattr);
>               return (0);
>  Index: nfs/nfs_srvsubs.c
>  ===================================================================
>  RCS file: /cvsroot/src/sys/nfs/nfs_srvsubs.c,v
>  retrieving revision 1.8
>  diff -u -p -r1.8 nfs_srvsubs.c
>  --- nfs/nfs_srvsubs.c        30 Nov 2010 10:30:03 -0000      1.8
>  +++ nfs/nfs_srvsubs.c        17 Mar 2011 09:14:46 -0000
>  @@ -276,6 +276,7 @@ nfs_namei(struct nameidata *ndp, nfsrvfh
>   out:
>       if (ndp->ni_pathbuf != NULL) {
>               pathbuf_destroy(ndp->ni_pathbuf);
>  +            ndp->ni_pathbuf = NULL;
>       } else {
>               PNBUF_PUT(path);
>       }
>  
>  
>  -- 
>  David A. Holland
>  dholland%netbsd.org@localhost
>  

--
Takahiro HAYASHI



Home | Main Index | Thread Index | Old Index