mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 11:47:43 +03:00
3246 ZFS I/O deadman thread
Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com> Reviewed by: Eric Schrock <eric.schrock@delphix.com> Reviewed by: Christopher Siden <chris.siden@delphix.com> Approved by: Garrett D'Amore <garrett@damore.org> NOTES: This patch has been reworked from the original in the following ways to accomidate Linux ZFS implementation *) Usage of the cyclic interface was replaced by the delayed taskq interface. This avoids the need to implement new compatibility code and allows us to rely on the existing taskq implementation. *) An extern for zfs_txg_synctime_ms was added to sys/dsl_pool.h because declaring externs in source files as was done in the original patch is just plain wrong. *) Instead of panicing the system when the deadman triggers a zevent describing the blocked vdev and the first pending I/O is posted. If the panic behavior is desired Linux provides other generic methods to panic the system when threads are observed to hang. *) For reference, to delay zios by 30 seconds for testing you can use zinject as follows: 'zinject -d <vdev> -D30 <pool>' References: illumos/illumos-gate@283b84606b https://www.illumos.org/issues/3246 Ported-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #1396
This commit is contained in:
committed by
Brian Behlendorf
parent
57f5a2008e
commit
cc92e9d0c3
+37
-28
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -147,14 +148,8 @@ zio_handle_fault_injection(zio_t *zio, int error)
|
||||
for (handler = list_head(&inject_handlers); handler != NULL;
|
||||
handler = list_next(&inject_handlers, handler)) {
|
||||
|
||||
/* Ignore errors not destined for this pool */
|
||||
if (zio->io_spa != handler->zi_spa)
|
||||
continue;
|
||||
|
||||
/* Ignore device errors and panic injection */
|
||||
if (handler->zi_record.zi_guid != 0 ||
|
||||
handler->zi_record.zi_func[0] != '\0' ||
|
||||
handler->zi_record.zi_duration != 0)
|
||||
if (zio->io_spa != handler->zi_spa ||
|
||||
handler->zi_record.zi_cmd != ZINJECT_DATA_FAULT)
|
||||
continue;
|
||||
|
||||
/* If this handler matches, return EIO */
|
||||
@@ -197,10 +192,7 @@ zio_handle_label_injection(zio_t *zio, int error)
|
||||
uint64_t start = handler->zi_record.zi_start;
|
||||
uint64_t end = handler->zi_record.zi_end;
|
||||
|
||||
/* Ignore device only faults or panic injection */
|
||||
if (handler->zi_record.zi_start == 0 ||
|
||||
handler->zi_record.zi_func[0] != '\0' ||
|
||||
handler->zi_record.zi_duration != 0)
|
||||
if (handler->zi_record.zi_cmd != ZINJECT_LABEL_FAULT)
|
||||
continue;
|
||||
|
||||
/*
|
||||
@@ -246,13 +238,7 @@ zio_handle_device_injection(vdev_t *vd, zio_t *zio, int error)
|
||||
for (handler = list_head(&inject_handlers); handler != NULL;
|
||||
handler = list_next(&inject_handlers, handler)) {
|
||||
|
||||
/*
|
||||
* Ignore label specific faults, panic injection
|
||||
* or fake writes
|
||||
*/
|
||||
if (handler->zi_record.zi_start != 0 ||
|
||||
handler->zi_record.zi_func[0] != '\0' ||
|
||||
handler->zi_record.zi_duration != 0)
|
||||
if (handler->zi_record.zi_cmd != ZINJECT_DEVICE_FAULT)
|
||||
continue;
|
||||
|
||||
if (vd->vdev_guid == handler->zi_record.zi_guid) {
|
||||
@@ -316,10 +302,8 @@ zio_handle_ignored_writes(zio_t *zio)
|
||||
handler = list_next(&inject_handlers, handler)) {
|
||||
|
||||
/* Ignore errors not destined for this pool */
|
||||
if (zio->io_spa != handler->zi_spa)
|
||||
continue;
|
||||
|
||||
if (handler->zi_record.zi_duration == 0)
|
||||
if (zio->io_spa != handler->zi_spa ||
|
||||
handler->zi_record.zi_cmd != ZINJECT_IGNORED_WRITES)
|
||||
continue;
|
||||
|
||||
/*
|
||||
@@ -355,11 +339,8 @@ spa_handle_ignored_writes(spa_t *spa)
|
||||
for (handler = list_head(&inject_handlers); handler != NULL;
|
||||
handler = list_next(&inject_handlers, handler)) {
|
||||
|
||||
/* Ignore errors not destined for this pool */
|
||||
if (spa != handler->zi_spa)
|
||||
continue;
|
||||
|
||||
if (handler->zi_record.zi_duration == 0)
|
||||
if (spa != handler->zi_spa ||
|
||||
handler->zi_record.zi_cmd != ZINJECT_IGNORED_WRITES)
|
||||
continue;
|
||||
|
||||
if (handler->zi_record.zi_duration > 0) {
|
||||
@@ -379,6 +360,34 @@ spa_handle_ignored_writes(spa_t *spa)
|
||||
rw_exit(&inject_lock);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
zio_handle_io_delay(zio_t *zio)
|
||||
{
|
||||
vdev_t *vd = zio->io_vd;
|
||||
inject_handler_t *handler;
|
||||
uint64_t seconds = 0;
|
||||
|
||||
if (zio_injection_enabled == 0)
|
||||
return (0);
|
||||
|
||||
rw_enter(&inject_lock, RW_READER);
|
||||
|
||||
for (handler = list_head(&inject_handlers); handler != NULL;
|
||||
handler = list_next(&inject_handlers, handler)) {
|
||||
|
||||
if (handler->zi_record.zi_cmd != ZINJECT_DELAY_IO)
|
||||
continue;
|
||||
|
||||
if (vd->vdev_guid == handler->zi_record.zi_guid) {
|
||||
seconds = handler->zi_record.zi_timer;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
rw_exit(&inject_lock);
|
||||
return (seconds);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new handler for the given record. We add it to the list, adding
|
||||
* a reference to the spa_t in the process. We increment zio_injection_enabled,
|
||||
|
||||
Reference in New Issue
Block a user