Skip to content

Commit

Permalink
Prevent zdb(8) from occasionally hanging on I/O
Browse files Browse the repository at this point in the history
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 openzfs#6999
  • Loading branch information
behlendorf committed Jan 25, 2018
1 parent 8fb1ede commit bb25362
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/zdb/zdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -4542,13 +4542,23 @@ 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);

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']) {
Expand Down

0 comments on commit bb25362

Please sign in to comment.