Really Old Bugs
Apparently there is a bug from kernels as old as 2.5.44 that pop up every so often causing hours of work for developers to hunt down. Hopefully it can be fixed upstream, or maybe this is a “won’t fix” for some very good reason that I am unaware of: http://osdir.com/ml/linux.enbd.general/2002-10/msg00176.html . In my opinion, an issue like this should give some meaningful error rather than causing deadlock.
Basically add_disk (and therefore register_disk() where the problem actually resides) must be called *before* set_capacity() in Linux block device drivers. This is backwards of the way I would think, as I would configure the device parameters before publishing it into userspace—but that is backwards in the Linux kernel and can (will?) cause deadlock.
Recently I encountered this issue/bug in a zfs-git (zfsonlinux) build. I’ve resolved the kernel hang and I’m working on a minimal patch for ZFS. For now follow this ZFS ZVOL issue on github: https://github.com/zfsonlinux/zfs/issues/1488 .
Update: a pull request is pending here: https://github.com/zfsonlinux/zfs/pull/1491 and a patch has been listed on the issues page.