Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jan 2004 15:23:32 -0500
From:      John Baldwin <jhb@FreeBSD.org>
To:        des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=)
Cc:        current@freebsd.org
Subject:   Re: Panic with this morning's (~9am EDT, 15 jan 2004) sources.
Message-ID:  <200401161523.32120.jhb@FreeBSD.org>
In-Reply-To: <xzpvfnbslix.fsf@dwp.des.no>
References:  <EE3D3FBAFFCAED448C21C398FDAD91AC0108D8@EBE1.gc.nat> <200401161458.34197.jhb@FreeBSD.org> <xzpvfnbslix.fsf@dwp.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 16 January 2004 03:09 pm, Dag-Erling Sm=F8rgrav wrote:
> John Baldwin <jhb@FreeBSD.org> writes:
> >          You probably don't need to lock the new filedesc structure
> > while you are creating it until you've actually hooked it up to a
> > proc structure.
>
> Yes, I do.  fdgrowtable() for instance asserts that the filedesc is
> locked.

Then do this:

	while (newfdp blah fdp) {
		FILEDESC_UNLOCK(fdp);
		FILEDESC_LOCK(newfdp);
		fd_growtable(newfdp);
		FILEDESC_UNLOCK(newfdp);
		FILEDESC_LOCK(fdp);
	}

Since no other CPU or thread can possibly go near newfdp until it is hooked=
=20
into a process, you don't need to worry about locking it other than to=20
satisfy assertions while you are constructing it.

=2D-=20
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =3D  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401161523.32120.jhb>