zfsonlinux/zfs — pull request #1220 by maxximino (2013-01-18 02:08:48+00:00)
Title: Fix zpool on zvol deadlock

Commit 65d56083b4617a4cade0cff68cbbaf68114169d6 fixes the lock inversion
between spa_namespace_lock and bdev->bd_mutex but only for the first
user of spa_namespace_lock: dmu_objset_own. Later spa_namespace_lock
gets acquired by dsl_prop_get_integer
(dsl_prop_get->dsl_dataset_hold->dsl_dir_open_spa->spa_open->spa_open_common)
without this "protection". By moving the mutex release after this
second use, even this acquisition of the lock is "protected" by the
ERESTARTSYS trick.

zfs create mypool/internalpool -V 40G; zpool create intpool /dev/mypool/internalpool
was consistently failing for me, and now is consistently working.