summaryrefslogtreecommitdiffstats
path: root/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2013-02-26 01:05:25 +0000
committerattilio <attilio@FreeBSD.org>2013-02-26 01:05:25 +0000
commit756a9b3e47fbf2ace170ae77caa02eed2c059ec1 (patch)
tree68506ced6483bc7d8c7699530ea0c979e53d9ae4 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
parent2ad8e10333f151d4744c8dfc21f28ed627d114f5 (diff)
parentcb47f0509be0470c174870a68ed3c1d94eb52ed7 (diff)
downloadFreeBSD-src-756a9b3e47fbf2ace170ae77caa02eed2c059ec1.zip
FreeBSD-src-756a9b3e47fbf2ace170ae77caa02eed2c059ec1.tar.gz
MFC
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
index 2d92975..17cb6c1 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
@@ -3173,3 +3173,41 @@ vdev_split(vdev_t *vd)
}
vdev_propagate_state(cvd);
}
+
+void
+vdev_deadman(vdev_t *vd)
+{
+ for (int c = 0; c < vd->vdev_children; c++) {
+ vdev_t *cvd = vd->vdev_child[c];
+
+ vdev_deadman(cvd);
+ }
+
+ if (vd->vdev_ops->vdev_op_leaf) {
+ vdev_queue_t *vq = &vd->vdev_queue;
+
+ mutex_enter(&vq->vq_lock);
+ if (avl_numnodes(&vq->vq_pending_tree) > 0) {
+ spa_t *spa = vd->vdev_spa;
+ zio_t *fio;
+ uint64_t delta;
+
+ /*
+ * Look at the head of all the pending queues,
+ * if any I/O has been outstanding for longer than
+ * the spa_deadman_synctime we panic the system.
+ */
+ fio = avl_first(&vq->vq_pending_tree);
+ delta = ddi_get_lbolt64() - fio->io_timestamp;
+ if (delta > NSEC_TO_TICK(spa_deadman_synctime(spa))) {
+ zfs_dbgmsg("SLOW IO: zio timestamp %llu, "
+ "delta %llu, last io %llu",
+ fio->io_timestamp, delta,
+ vq->vq_io_complete_ts);
+ fm_panic("I/O to pool '%s' appears to be "
+ "hung.", spa_name(spa));
+ }
+ }
+ mutex_exit(&vq->vq_lock);
+ }
+}
OpenPOWER on IntegriCloud