Subject: Re: unable to allocate scsipi_xfer.
To: Peter Seebach <seebs@plethora.net>
From: enami tsugutomo <enami@sm.sony.co.jp>
List: current-users
Date: 05/27/2003 13:57:15
seebs@plethora.net (Peter Seebach) writes:

> I've also noticed that it only happens to me under heavy *NFS* load.
> Hmm.  It does have a memory-leakish feel to it, though.

Try this.

enami.

Index: nfs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_vnops.c,v
retrieving revision 1.169
diff -u -r1.169 nfs_vnops.c
--- nfs_vnops.c	26 May 2003 13:34:38 -0000	1.169
+++ nfs_vnops.c	27 May 2003 04:48:21 -0000
@@ -258,7 +258,7 @@
 const struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc =
 	{ &fifo_nfsv2nodeop_p, fifo_nfsv2nodeop_entries };
 
-static void nfs_noop(struct mbuf *, caddr_t, size_t, void *);
+static void nfs_writerpc_extfree(struct mbuf *, caddr_t, size_t, void *);
 
 /*
  * Global variables
@@ -1210,11 +1210,14 @@
 }
 
 /*
- * dummy callback for mbuf.
+ * free mbuf used to refer protected pages while write rpc call.
  */
 static void
-nfs_noop(struct mbuf *m, caddr_t buf, size_t size, void *arg)
+nfs_writerpc_extfree(struct mbuf *m, caddr_t buf, size_t size, void *arg)
 {
+
+	KASSERT(m != NULL);
+	pool_cache_put(&mbpool_cache, m);
 }
 
 /*
@@ -1288,8 +1291,9 @@
 			struct iovec *iovp = uiop->uio_iov;
 
 			m = m_get(M_WAIT, MT_DATA);
-			MCLAIM(m, &nfs_owner);
-			MEXTADD(m, iovp->iov_base, len, M_MBUF, nfs_noop, NULL);
+			MCLAIM(m, &nfs_mowner);
+			MEXTADD(m, iovp->iov_base, len, M_MBUF,
+			    nfs_writerpc_extfree, NULL);
 			m->m_flags |= M_EXT_ROMAP;
 			m->m_len = len;
 			mb->m_next = m;