malloc(M_WAITOK) of "32", forcing M_NOWAIT
Robert Watson
rwatson at FreeBSD.org
Thu Jun 24 14:11:47 GMT 2004
On Thu, 24 Jun 2004, Jun Kuriyama wrote:
> I don't know how to fix correctly. But it has disappeared with
> following patch. Grrr.
I think this is not quite correct; you will need to unlock the nfsd_mtx
regardless of the state of RC_LOCKED, as that's a structure sleep lock and
nfsd_mtx should be locked at that point regardless of RC_LOCKED. Assuming
this code was safe on 4.x and performed a blocking socket addr copy here,
it should also be safe on 5.x to drop nfsd_mtx here.
Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
robert at fledge.watson.org Senior Research Scientist, McAfee Research
>
> 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
> @@ -247,10 +247,19 @@
> 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
> _______________________________________________
> freebsd-current at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe at freebsd.org"
>
More information about the freebsd-current
mailing list