From owner-svn-src-all@FreeBSD.ORG Thu Nov 3 07:52:21 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FD211065670; Thu, 3 Nov 2011 07:52:21 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id BA4878FC18; Thu, 3 Nov 2011 07:52:20 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 485B92F3; Thu, 3 Nov 2011 08:52:19 +0100 (CET) Date: Thu, 3 Nov 2011 08:51:32 +0100 From: Pawel Jakub Dawidek To: Alexander Motin Message-ID: <20111103075132.GA1682@garage.freebsd.pl> References: <201111020924.pA29OxUV009135@svn.freebsd.org> <20111102134226.GA1656@garage.freebsd.pl> <4EB15D36.9020409@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="T4sUOijqQbZv57TR" Content-Disposition: inline In-Reply-To: <4EB15D36.9020409@FreeBSD.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r227015 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Nov 2011 07:52:21 -0000 --T4sUOijqQbZv57TR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 02, 2011 at 05:09:42PM +0200, Alexander Motin wrote: > On 11/02/11 15:42, Pawel Jakub Dawidek wrote: > > On Wed, Nov 02, 2011 at 09:24:59AM +0000, Alexander Motin wrote: > >> Author: mav > >> Date: Wed Nov 2 09:24:59 2011 > >> New Revision: 227015 > >> URL: http://svn.freebsd.org/changeset/base/227015 > >> > >> Log: > >> Add mutex and two flags to make orphan() call properly asynchronous: > >> - delay consumer closing and detaching on orphan() until all I/Os c= omplete; > >> - prevent new I/Os submission after orphan() called. > >> Previous implementation could destroy consumers still having active > >> requests and worked only because of global workaround made on GEOM l= evel. > >=20 > > Alexander, I'm not sure I agree with your recent changes to address > > this. The checks in GEOM were there to avoid the need for counting > > outstanding I/O requests in every single GEOM class. >=20 > Sorry, I've sent you letter last week asking for your opinion on this > problem, but got no response. :( I did not receive it, sorry. > > Why do you think the checks in GEOM are not good enough? >=20 > Mostly because nstart increment and request submission are not locked. > There are race windows between start() call, request submission and > consumer detach: start() method may get provider pointer that will not > be valid in time of the request submission. >=20 > According geom(4), that race should be closed by assumption that > provider should not be closed until all active requests are completed. > Kind of reference counting, done by top consumers, such as geom_dev or > geom_vfs. That is what I am trying to fix with my changes. >=20 > Also I don't very like idea of periodic polling, trying to catch moment > when nstart =3D=3D nend. As soon as at that time we haven't called orphan= () > method yet, requests may go infinitely, even though each will be aborted > quickly. It looks dirty at least. >=20 > Counting of outstanding I/O requests needed only for classes that for > some reason can't follow that assumption. For example, geom_vfs releases > provider as soon as it orphans, not waiting for close() call from file > system. Another example is gmirror -- we want to drop single > disconnected disk while upstream provider is still working and won't be > closed. Ok, I can see your point now. You are right. The check that nstart is equal to nend I added was not to fix races within one class. IIRC I was seeing panics there with simple classes that only forward orphan events, so even if provider's error was set and no new I/O requests were coming, we could destroy orphaned provider even if there were still in-flight requests. I was a bit confused, because you were refering to the check I added and I don't think it is really related. > > Can we design solution that can be implemented in the framework itself, > > so simple GEOM classes can stay simple? >=20 > Simple classes without special needs around access() method and > especially with one consumer should stay simple. All they should do on > orphan() call is just forward orphan() call up, calling some > g_wither_XXX() and not trying to forcefully close consumer, and let > things happen naturally. >=20 > The problem is that start() and bio_done() methods are not locked now, > but same time they expect topology not to change under them. I am not > sure how can it be simplified globally, unless we want to lock all of > them with topology lock. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --T4sUOijqQbZv57TR Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk6ySAMACgkQForvXbEpPzTWwgCgpTH1CxznkLEdLordlt9+yvYL +SoAoL1xgwZY0mDnH5z1A/iWHYFjQmKA =LUib -----END PGP SIGNATURE----- --T4sUOijqQbZv57TR--