Date: Mon, 13 Jun 2011 22:15:43 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: "Justin T. Gibbs" <gibbs@FreeBSD.org> Cc: fs@FreeBSD.org Subject: Re: Drop of spa_namespace lock in vdev_geom.c Message-ID: <20110613201543.GA1733@garage.freebsd.pl> In-Reply-To: <4DF25544.3020301@FreeBSD.org> References: <4DF25544.3020301@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--KsGdsel6WgEHnImy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 10, 2011 at 11:32:52AM -0600, Justin T. Gibbs wrote: > Dropping and reacquiring the spa_namespace lock in vdev_geom_open() > creates a lock order reversal with the spa_config locks. As the > spa_config locks are not standard mutexes, witness will not warn > about this issue. I only noticed this problem when debugging a ZFS > deadlock. The deadlock can be triggered anytime that there are > multiple insert/remove processes going on (e.g. vdev orphan processing > while a fault management daemon is onlining a replacement device for > some other vdev). >=20 > I haven't noticed any issues with just holding the namespace lock > for the duration of the open. Does anyone know why this lock drop > was added in v28? I did that as part of @182208 to fix another LOR. Full commit log: Change 182208 on 2010/08/10 by pjd@pjd_zoo OpenSolaris switched to lazy creation of /dev/ entires for ZVOLs. It creates /dev/ entries on VOP_LOOKUP() or VOP_READDIR(). This of course can't work this way on FreeBSD with GEOM, so we need to create ZVOL providers where appropriate. I found the following cases: 1. Pool first open (pool is loaded based on zpool/cache configuration and is then opened for a first time on eg. zfs mount). 2. Pool import. It's not the same as 1. 3. ZVOL creation: zfs create -V<size> <zvol>. 4. Creation of ZVOL snapshot, this includes recursive snapshot creation. To make it work I had to fix LOR between the zfsdev_state_lock, the GEOM topology lock and the spa_namespace_lock. They are now always obtained in the following order: 1. zfsdev_state_lock 2. g_topology_lock 3. spa_namespace_lock Also, we can't use taskqueue to scan for VDEVs as this introduces deadlock (because there is no way to honour the order above). This also allows to simplify vdev_geom.c quite a bit as it is no longer a problem to taste ZVOL or ZVOL-based provider. Update /etc/rc.d/zvol as there are no longer volinit and volfini subcommands to zfs(8). --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --KsGdsel6WgEHnImy Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk32b+8ACgkQForvXbEpPzTTMQCeOpNr4VS569h9QhAbnCGgVqh/ cI8AoOS/q1Y0dNsRP2hBO2KYWdtwnWUU =SQsf -----END PGP SIGNATURE----- --KsGdsel6WgEHnImy--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110613201543.GA1733>