Date: Fri, 2 Dec 2011 00:17:21 +0100 From: Baptiste Daroussin <bapt@freebsd.org> To: Olivier Houchard <mlfbsd@kanar.ci0.org> Cc: Kostik Belousov <kostikbel@gmail.com>, freebsd-current@freebsd.org, imp@freebsd.org Subject: Re: [patch] turning devctl into a "multiple openable" device Message-ID: <20111201231721.GA1669@azathoth.lan> In-Reply-To: <20111130162017.GA53362@ci0.org> 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>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] 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 could > > > > be woken up unconditionally everytime. What is the reason for the cv_wait > > > > call in cdevpriv data destructor ? You cannot have a thread doing e.g. > > > > read on the file descriptor while destructor is run. > > > > > > > > > > What will prevent you from having a thread stuck in read(), while an another > > > one close() the fd ? > > > > > 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 threads, > > and new accesses are impossible since file descriptors also own references > > on the file. > > Right, I was a bit confused, this part can be removed. > > Regards, > > 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 [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7YCwEACgkQ8kTtMUmk6ExLuACgttivMDuC+ZsXNQ2Kd4kPAPhm wiUAn1uXcrEk2gIZCW2ZH98/LUFexh2l =wL+Q -----END PGP SIGNATURE-----help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111201231721.GA1669>
