diff options
author | Serapheim Dimitropoulos <[email protected]> | 2019-07-18 13:02:33 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-07-18 13:02:33 -0700 |
commit | 43a8536260e76dab4a615164f9e6d6397c6b7778 (patch) | |
tree | b5a8ab080464448090b92fc3b1eb1b86ce092366 /include | |
parent | 1c44a5c97fabc669885df84c3e9b6b5e16f0cd35 (diff) |
Race condition between spa async threads and export
In the past we've seen multiple race conditions that have
to do with open-context threads async threads and concurrent
calls to spa_export()/spa_destroy() (including the one
referenced in issue #9015).
This patch ensures that only one thread can execute the
main body of spa_export_common() at a time, with subsequent
threads returning with a new error code created just for
this situation, eliminating this way any race condition
bugs introduced by concurrent calls to this function.
Reviewed by: Matt Ahrens <[email protected]>
Reviewed by: Brian Behlendorf <[email protected]>
Signed-off-by: Serapheim Dimitropoulos <[email protected]>
Closes #9015
Closes #9044
Diffstat (limited to 'include')
-rw-r--r-- | include/libzfs.h | 1 | ||||
-rw-r--r-- | include/sys/fs/zfs.h | 1 | ||||
-rw-r--r-- | include/sys/spa_impl.h | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/include/libzfs.h b/include/libzfs.h index 79e7692cd..22cb0408e 100644 --- a/include/libzfs.h +++ b/include/libzfs.h @@ -147,6 +147,7 @@ typedef enum zfs_error { EZFS_NO_TRIM, /* no active trim */ EZFS_TRIM_NOTSUP, /* device does not support trim */ EZFS_NO_RESILVER_DEFER, /* pool doesn't support resilver_defer */ + EZFS_EXPORT_IN_PROGRESS, /* currently exporting the pool */ EZFS_UNKNOWN } zfs_error_t; diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index 2cd133b1f..b4f3ede9b 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -1324,6 +1324,7 @@ typedef enum { ZFS_ERR_FROM_IVSET_GUID_MISMATCH, ZFS_ERR_SPILL_BLOCK_FLAG_MISSING, ZFS_ERR_UNKNOWN_SEND_STREAM_FEATURE, + ZFS_ERR_EXPORT_IN_PROGRESS, } zfs_errno_t; /* diff --git a/include/sys/spa_impl.h b/include/sys/spa_impl.h index ff69286cc..929144017 100644 --- a/include/sys/spa_impl.h +++ b/include/sys/spa_impl.h @@ -220,6 +220,7 @@ struct spa { spa_taskqs_t spa_zio_taskq[ZIO_TYPES][ZIO_TASKQ_TYPES]; dsl_pool_t *spa_dsl_pool; boolean_t spa_is_initializing; /* true while opening pool */ + boolean_t spa_is_exporting; /* true while exporting pool */ metaslab_class_t *spa_normal_class; /* normal data class */ metaslab_class_t *spa_log_class; /* intent log data class */ metaslab_class_t *spa_special_class; /* special allocation class */ |