zfs: call spa_deadman on a taskqueue thread
authoravg <avg@FreeBSD.org>
Sat, 25 Feb 2017 16:45:53 +0000 (16:45 +0000)
committeravg <avg@FreeBSD.org>
Sat, 25 Feb 2017 16:45:53 +0000 (16:45 +0000)
commitd895ce4e14b229581545c829571b87366e5261e2
tree64f875714c5d64180745f7bed4cb431c0759e77f
parente4abb6a4a9d394008f5bfd760e2c4683227517ae
zfs: call spa_deadman on a taskqueue thread

callout(9) prohibits callout functions from sleeping.
illumos mutexes are emulated using sx(9).
spa_deadman() calls vdev_deadman() and the latter acquires vq_lock.

As a result we can get a more confusing panic instead of a specific
panic or no panic:
sleepq_add: td 0xfffff80019669960 to sleep on wchan 0xfffff8001cff4d88 with sleeping prohibited

This change adds another level of indirection where the deadman
callout schedules spa_deadman() to be executed on taskqueue_thread.

While there, use callout_schedule(0 instead of callout_reset()
in spa_sync().

Discussed with: mav
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D9762
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h