summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2018-01-08 16:15:23 -0800
committerBrian Behlendorf <[email protected]>2018-01-25 13:41:51 -0800
commitbb253625538824d8acae6ef62f5cdc7b1a525633 (patch)
treea8908e2794ad2ca6d8a946a591cbdcc2b0ebff40 /cmd
parent8fb1ede146426e2217b35a254b4660e264854fa1 (diff)
Prevent zdb(8) from occasionally hanging on I/O
The zdb(8) command may not terminate in the case where the pool gets suspended and there is a caller in zio_wait() blocking on an outstanding read I/O that will never complete. This can in turn cause ztest(1) to block indefinitely despite the deadman. Resolve the issue by setting the default failure mode for zdb(8) to panic. In user space we always want the command to terminate when forward progress is no longer possible. Reviewed-by: Tim Chase <[email protected]> Reviewed by: Thomas Caputi <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #6999
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zdb/zdb.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index 69001071d..1415be864 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -4542,6 +4542,8 @@ main(int argc, char **argv)
}
} else {
error = open_objset(target, DMU_OST_ANY, FTAG, &os);
+ if (error == 0)
+ spa = dmu_objset_spa(os);
}
}
nvlist_free(policy);
@@ -4549,6 +4551,14 @@ main(int argc, char **argv)
if (error)
fatal("can't open '%s': %s", target, strerror(error));
+ /*
+ * Set the pool failure mode to panic in order to prevent the pool
+ * from suspending. A suspended I/O will have no way to resume and
+ * can prevent the zdb(8) command from terminating as expected.
+ */
+ if (spa != NULL)
+ spa->spa_failmode = ZIO_FAILURE_MODE_PANIC;
+
argv++;
argc--;
if (!dump_opt['R']) {