freebsd-dev/sys/cddl
Andriy Gapon 1db5f1724b fix an architectural problem introduced in r320156, ZFS ABD import
The implementation of ZFS refcount_t uses the emulated illumos mutex
(the sx lock) and the waiting memory allocation when ZFS_DEBUG is
enabled.  This makes refcount_t unsuitable for use in GEOM g_up
thread where sleeping is prohibited.

When importing the ABD change I modified vdev_geom using illumos
vdev_disk as an example.  As a result, I added a call to abd_return_buf
in vdev_geom_io_intr.  The latter is called on g_up thread while the
former uses refcount_t.

This change fixes the problem by deferring the abd_return_buf call to
the previously unused vdev_geom_io_done that is called on a ZFS zio
taskqueue thread where sleeping is allowed.

A side bonus of this change is that now a vdev zio has a pointer
to its corresponding bio while the zio is active.

Reported by:	Shawn Webb <shawn.webb@hardenedbsd.org>
Tested by:	Shawn Webb <shawn.webb@hardenedbsd.org>
MFC after:	1 week
X-MFC with:	r320156
2017-06-28 13:59:20 +00:00
..
boot/zfs loader: update symlink support in zfs reader 2017-02-22 22:00:50 +00:00
compat/opensolaris Commit the 64-bit inode project. 2017-05-23 09:29:05 +00:00
contrib/opensolaris fix an architectural problem introduced in r320156, ZFS ABD import 2017-06-28 13:59:20 +00:00
dev Follow up r313841 on powerpc 2017-06-09 20:26:42 +00:00