Drop of spa_namespace lock in vdev_geom.c
Pawel Jakub Dawidek
pjd at FreeBSD.org
Mon Jun 13 20:15:53 UTC 2011
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).
> 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 at 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
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
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:
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).
Pawel Jakub Dawidek http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://yomoli.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20110613/bde2da13/attachment.pgp
More information about the freebsd-fs