From owner-freebsd-current@FreeBSD.ORG Thu Dec 1 23:17:25 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34FE5106566B; Thu, 1 Dec 2011 23:17:25 +0000 (UTC) (envelope-from bapt@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 000FA8FC08; Thu, 1 Dec 2011 23:17:24 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id pB1NHOCZ090417; Thu, 1 Dec 2011 23:17:24 GMT (envelope-from bapt@freebsd.org) Received: (from bapt@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id pB1NHOgJ090416; Thu, 1 Dec 2011 23:17:24 GMT (envelope-from bapt@freebsd.org) X-Authentication-Warning: freefall.freebsd.org: bapt set sender to bapt@freebsd.org using -f Date: Fri, 2 Dec 2011 00:17:21 +0100 From: Baptiste Daroussin To: Olivier Houchard Message-ID: <20111201231721.GA1669@azathoth.lan> References: <20111130124320.GA1449@azathoth.lan> <201111301005.11938.jhb@freebsd.org> <20111130154636.GX50300@deviant.kiev.zoral.com.ua> <20111130155521.GA52567@ci0.org> <20111130160450.GY50300@deviant.kiev.zoral.com.ua> <20111130162017.GA53362@ci0.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FL5UXtIhxfXey3p5" Content-Disposition: inline In-Reply-To: <20111130162017.GA53362@ci0.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Kostik Belousov , freebsd-current@freebsd.org, imp@freebsd.org Subject: Re: [patch] turning devctl into a "multiple openable" device X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2011 23:17:25 -0000 --FL5UXtIhxfXey3p5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 30, 2011 at 05:20:17PM +0100, Olivier Houchard wrote: > On Wed, Nov 30, 2011 at 06:04:50PM +0200, Kostik Belousov wrote: > > > > I wonder why the waiting_threads stuff is needed at all. The cv cou= ld > > > > be woken up unconditionally everytime. What is the reason for the c= v_wait > > > > call in cdevpriv data destructor ? You cannot have a thread doing e= =2Eg. > > > > read on the file descriptor while destructor is run. > > > >=20 > > >=20 > > > What will prevent you from having a thread stuck in read(), while an = another=20 > > > one close() the fd ? > > >=20 > > Nothing, but file reference count goes to zero only after the thread > > stuck in read is unstuck. Cdevpriv destructor is run only when file > > reference count becomes zero, i.e. there can be no any accessing thread= s, > > and new accesses are impossible since file descriptors also own referen= ces > > on the file. >=20 > Right, I was a bit confused, this part can be removed. >=20 > Regards, >=20 > Olivier Here is a new version of the patch mostly reworked by Olivier, It doesn't duplicate anymore the devq, and fix all that have been spotted here previously. http://people.freebsd.org/~bapt/devctl_multi_open.diff bonus, it removes the needless giant lock regards, Bapt --FL5UXtIhxfXey3p5 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7YCwEACgkQ8kTtMUmk6ExLuACgttivMDuC+ZsXNQ2Kd4kPAPhm wiUAn1uXcrEk2gIZCW2ZH98/LUFexh2l =wL+Q -----END PGP SIGNATURE----- --FL5UXtIhxfXey3p5--