diff options
author | Olaf Faaland <[email protected]> | 2018-03-15 10:56:55 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-03-15 10:56:55 -0700 |
commit | cec3a0a1bb08574260a9e39301a24ce79dbfb69a (patch) | |
tree | e1001369e5229c9b304b67b371b1096496deedeb /module/zfs | |
parent | 38742209322b5b3d93635a4820b2f9c755aadee8 (diff) |
Report pool suspended due to MMP
When the pool is suspended, record whether it was due to an I/O error or
due to MMP writes failing to succeed within the required time.
Change spa_suspended from uint8_t to zio_suspend_reason_t to store the
reason.
When userspace queries pool status via spa_tryimport(), report the
reason the pool was suspended in a new key,
ZPOOL_CONFIG_SUSPENDED_REASON.
In libzfs, when interpreting the returned config nvlist, report
suspension due to MMP with a new pool status enum value,
ZPOOL_STATUS_IO_FAILURE_MMP.
In status_callback(), which generates and emits the message when 'zpool
status' is executed, add a case to print an appropriate message for the
new pool status enum value.
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Olaf Faaland <[email protected]>
Closes #7296
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/mmp.c | 2 | ||||
-rw-r--r-- | module/zfs/spa.c | 8 | ||||
-rw-r--r-- | module/zfs/spa_misc.c | 2 | ||||
-rw-r--r-- | module/zfs/zio.c | 8 |
4 files changed, 12 insertions, 8 deletions
diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c index 757dfa82d..14379d804 100644 --- a/module/zfs/mmp.c +++ b/module/zfs/mmp.c @@ -520,7 +520,7 @@ mmp_thread(void *arg) "succeeded in over %llus; suspending pool", spa_name(spa), NSEC2SEC(start - mmp->mmp_last_write)); - zio_suspend(spa, NULL); + zio_suspend(spa, NULL, ZIO_SUSPEND_MMP); } if (multihost && !suspended) diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 736b51fea..1e9e7b013 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -3766,10 +3766,14 @@ spa_get_stats(const char *name, nvlist_t **config, ZPOOL_CONFIG_ERRCOUNT, spa_get_errlog_size(spa)) == 0); - if (spa_suspended(spa)) + if (spa_suspended(spa)) { VERIFY(nvlist_add_uint64(*config, ZPOOL_CONFIG_SUSPENDED, spa->spa_failmode) == 0); + VERIFY(nvlist_add_uint64(*config, + ZPOOL_CONFIG_SUSPENDED_REASON, + spa->spa_suspended) == 0); + } spa_add_spares(spa, *config); spa_add_l2cache(spa, *config); @@ -6984,7 +6988,7 @@ spa_sync(spa_t *spa, uint64_t txg) if (error == 0) break; - zio_suspend(spa, NULL); + zio_suspend(spa, NULL, ZIO_SUSPEND_IOERR); zio_resume_wait(spa); } dmu_tx_commit(tx); diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c index c67bacbbb..d71468db3 100644 --- a/module/zfs/spa_misc.c +++ b/module/zfs/spa_misc.c @@ -1709,7 +1709,7 @@ spa_get_failmode(spa_t *spa) boolean_t spa_suspended(spa_t *spa) { - return (spa->spa_suspended); + return (spa->spa_suspended != ZIO_SUSPEND_NONE); } uint64_t diff --git a/module/zfs/zio.c b/module/zfs/zio.c index 7544cf4e3..44cf984d0 100644 --- a/module/zfs/zio.c +++ b/module/zfs/zio.c @@ -2092,7 +2092,7 @@ zio_reexecute(zio_t *pio) } void -zio_suspend(spa_t *spa, zio_t *zio) +zio_suspend(spa_t *spa, zio_t *zio, zio_suspend_reason_t reason) { if (spa_get_failmode(spa) == ZIO_FAILURE_MODE_PANIC) fm_panic("Pool '%s' has encountered an uncorrectable I/O " @@ -2112,7 +2112,7 @@ zio_suspend(spa_t *spa, zio_t *zio) ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | ZIO_FLAG_GODFATHER); - spa->spa_suspended = B_TRUE; + spa->spa_suspended = reason; if (zio != NULL) { ASSERT(!(zio->io_flags & ZIO_FLAG_GODFATHER)); @@ -2135,7 +2135,7 @@ zio_resume(spa_t *spa) * Reexecute all previously suspended i/o. */ mutex_enter(&spa->spa_suspend_lock); - spa->spa_suspended = B_FALSE; + spa->spa_suspended = ZIO_SUSPEND_NONE; cv_broadcast(&spa->spa_suspend_cv); pio = spa->spa_suspend_zio_root; spa->spa_suspend_zio_root = NULL; @@ -4390,7 +4390,7 @@ zio_done(zio_t *zio) * We'd fail again if we reexecuted now, so suspend * until conditions improve (e.g. device comes online). */ - zio_suspend(zio->io_spa, zio); + zio_suspend(zio->io_spa, zio, ZIO_SUSPEND_IOERR); } else { /* * Reexecution is potentially a huge amount of work. |