aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorOlaf Faaland <[email protected]>2018-03-15 10:56:55 -0700
committerBrian Behlendorf <[email protected]>2018-03-15 10:56:55 -0700
commitcec3a0a1bb08574260a9e39301a24ce79dbfb69a (patch)
treee1001369e5229c9b304b67b371b1096496deedeb /include
parent38742209322b5b3d93635a4820b2f9c755aadee8 (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 'include')
-rw-r--r--include/libzfs.h1
-rw-r--r--include/sys/fs/zfs.h1
-rw-r--r--include/sys/spa_impl.h2
-rw-r--r--include/sys/zio.h8
4 files changed, 10 insertions, 2 deletions
diff --git a/include/libzfs.h b/include/libzfs.h
index 5288ff7f8..00f22cfb1 100644
--- a/include/libzfs.h
+++ b/include/libzfs.h
@@ -333,6 +333,7 @@ typedef enum {
ZPOOL_STATUS_HOSTID_REQUIRED, /* multihost=on and hostid=0 */
ZPOOL_STATUS_IO_FAILURE_WAIT, /* failed I/O, failmode 'wait' */
ZPOOL_STATUS_IO_FAILURE_CONTINUE, /* failed I/O, failmode 'continue' */
+ ZPOOL_STATUS_IO_FAILURE_MMP, /* failed MMP, failmode not 'panic' */
ZPOOL_STATUS_BAD_LOG, /* cannot read log chain(s) */
ZPOOL_STATUS_ERRATA, /* informational errata available */
diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h
index 88f590276..e40c427f6 100644
--- a/include/sys/fs/zfs.h
+++ b/include/sys/fs/zfs.h
@@ -681,6 +681,7 @@ typedef struct zpool_rewind_policy {
#define ZPOOL_CONFIG_RESILVER_TXG "resilver_txg"
#define ZPOOL_CONFIG_COMMENT "comment"
#define ZPOOL_CONFIG_SUSPENDED "suspended" /* not stored on disk */
+#define ZPOOL_CONFIG_SUSPENDED_REASON "suspended_reason" /* not stored */
#define ZPOOL_CONFIG_TIMESTAMP "timestamp" /* not stored on disk */
#define ZPOOL_CONFIG_BOOTFS "bootfs" /* not stored on disk */
#define ZPOOL_CONFIG_MISSING_DEVICES "missing_vdevs" /* not stored on disk */
diff --git a/include/sys/spa_impl.h b/include/sys/spa_impl.h
index 66fcafd9c..af1d6aef0 100644
--- a/include/sys/spa_impl.h
+++ b/include/sys/spa_impl.h
@@ -236,7 +236,7 @@ struct spa {
zio_t *spa_suspend_zio_root; /* root of all suspended I/O */
kmutex_t spa_suspend_lock; /* protects suspend_zio_root */
kcondvar_t spa_suspend_cv; /* notification of resume */
- uint8_t spa_suspended; /* pool is suspended */
+ zio_suspend_reason_t spa_suspended; /* pool is suspended */
uint8_t spa_claiming; /* pool is doing zil_claim() */
boolean_t spa_debug; /* debug enabled? */
boolean_t spa_is_root; /* pool is root */
diff --git a/include/sys/zio.h b/include/sys/zio.h
index 8d5f99d46..9d3adb7f5 100644
--- a/include/sys/zio.h
+++ b/include/sys/zio.h
@@ -167,6 +167,12 @@ enum zio_encrypt {
#define ZIO_FAILURE_MODE_CONTINUE 1
#define ZIO_FAILURE_MODE_PANIC 2
+typedef enum zio_suspend_reason {
+ ZIO_SUSPEND_NONE = 0,
+ ZIO_SUSPEND_IOERR,
+ ZIO_SUSPEND_MMP,
+} zio_suspend_reason_t;
+
enum zio_flag {
/*
* Flags inherited by gang, ddt, and vdev children,
@@ -610,7 +616,7 @@ extern enum zio_checksum zio_checksum_dedup_select(spa_t *spa,
extern enum zio_compress zio_compress_select(spa_t *spa,
enum zio_compress child, enum zio_compress parent);
-extern void zio_suspend(spa_t *spa, zio_t *zio);
+extern void zio_suspend(spa_t *spa, zio_t *zio, zio_suspend_reason_t);
extern int zio_resume(spa_t *spa);
extern void zio_resume_wait(spa_t *spa);