Re: malloc(M_WAITOK) of "32", forcing M_NOWAIT

From: Jun Kuriyama <kuriyama_at_imgsrc.co.jp>
Date: Thu, 24 Jun 2004 14:27:59 +0900
At Thu, 17 Jun 2004 06:07:03 +0000 (UTC),
kuriyama wrote:
> malloc(M_WAITOK) of "32", forcing M_NOWAIT with the following non-sleepable locks held:
> exclusive sleep mutex nfsd_mtx r = 0 (0xc0745be0) locked _at_ nfsserver/nfs_srvcache.c:220
> Stack backtrace:
> backtrace(1,c06e06e0,c1035420,1,e4dffc24) at backtrace+0x12
> witness_warn(5,0,c06a35df,c067fc35) at witness_warn+0x18e
> uma_zalloc_arg(c1035420,0,2) at uma_zalloc_arg+0x38
> malloc(1c,c06e06e0,2,c4a80100,c3cffa00) at malloc+0xb2
> sodupsockaddr(c4c0af40,2,e4dffc78,40d11376,c3a47480) at sodupsockaddr+0x19
> nfsrv_getcache(c3cffa00,e4dffca8,0,2,2) at nfsrv_getcache+0x323
> nfssvc_nfsd(c3b0e000,c051627f,c0707920,0,c068f808) at nfssvc_nfsd+0x2b9
> nfssvc(c3b0e000,e4dffd14,2,0,292) at nfssvc+0x17b
> syscall(2f,2f,2f,bfbfeec4,1) at syscall+0x217
> Xint0x80_syscall() at Xint0x80_syscall+0x1f
> --- syscall (155), eip = 0x280c42fb, esp = 0xbfbfeb2c, ebp = 0xbfbfeb48 ---

I don't know how to fix correctly.  But it has disappeared with
following patch.  Grrr.

Index: nfs_srvcache.c
===================================================================
RCS file: /home/ncvs/src/sys/nfsserver/nfs_srvcache.c,v
retrieving revision 1.38
diff -u -r1.38 nfs_srvcache.c
--- nfs_srvcache.c	24 May 2004 04:06:14 -0000	1.38
+++ nfs_srvcache.c	22 Jun 2004 06:28:12 -0000
_at__at_ -247,10 +247,19 _at__at_
 		break;
 /*	case AF_INET6:	*/
 /*	case AF_ISO:	*/
-	default:
+	default: {
+		struct sockaddr *sa2;
 		rp->rc_flag |= RC_NAM;
-		rp->rc_nam = sodupsockaddr(nd->nd_nam, M_WAITOK);
+		if (rp->rc_flag | RC_LOCKED) {
+			NFSD_UNLOCK();
+		}
+		sa2 = sodupsockaddr(nd->nd_nam, M_WAITOK);
+		if (rp->rc_flag | RC_LOCKED) {
+			NFSD_LOCK();
+		}
+		rp->rc_nam = sa2;
 		break;
+	}
 	};
 	rp->rc_proc = nd->nd_procnum;
 	LIST_INSERT_HEAD(NFSRCHASH(nd->nd_retxid), rp, rc_hash);


-- 
Jun Kuriyama <kuriyama_at_imgsrc.co.jp> // IMG SRC, Inc.
             <kuriyama_at_FreeBSD.org> // FreeBSD Project
Received on Thu Jun 24 2004 - 03:28:09 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:58 UTC