]> git.proxmox.com Git - mirror_zfs.git/commit
Fix vdev_probe() call outside SCL_STATE_ALL lock
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 12 Jul 2017 00:35:34 +0000 (20:35 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 13 Jul 2017 17:54:10 +0000 (13:54 -0400)
commitcc9c6bcb7341cf37ccd4dfc939ec2abd4872e4bb
treea1021e5d429ef3f10a69cbcaa32502b1996547e4
parent379ca9cf2beba802f096273e89e30914a2d6bafc
Fix vdev_probe() call outside SCL_STATE_ALL lock

When an IO fails then zio_vdev_io_done() can call vdev_probe()
to determine the health of the vdev.  This is safe as long as
the original zio was submitted with zio_wait() and holds the
SCL_STATE_ALL lock over the operation.

If zio_no_wait() was used then the done callback will submit
the probe IO outside the SCL_STATE_ALL lock and hit this
ASSERT in zio_create()

  ASSERT(!vd || spa_config_held(spa, SCL_STATE_ALL, RW_READER));

Resolve the issue by only allowing vdev_probe() to be called
when there's a waiter indicating the caller is using zio_wait().
This assumes that caller is still holding SCL_STATE_ALL.

This issue isn't MMP specific but was surfaced when testing.
Without this patch it can be reproduced by running:

  zpool set multihost on <pool>
  zinject -d <vdev> -e io -T write -f 50 <pool> -L uber

Reviewed-by: Olaf Faaland <faaland1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Don Brady <don.brady@intel.com>
Closes #745
Closes #6279
module/zfs/zio.c