diff options
author | Ameer Hamza <[email protected]> | 2023-05-04 03:10:32 +0500 |
---|---|---|
committer | GitHub <[email protected]> | 2023-05-03 15:10:32 -0700 |
commit | 82ac409acc77935ae366b800ee7cefb14939bbae (patch) | |
tree | a9a3b0215d47ce90daaf34abee1fa0c8ed4d1493 /module/zfs | |
parent | a46001adb9b143eebf43cd7ca4b508c044f80f00 (diff) |
zpool import -m also removing spare and cache when log device is missing
spa_import() relies on a pool config fetched by spa_try_import() for
spare/cache devices. Import flags are not passed to spa_tryimport(),
which makes it return early due to a missing log device and missing
retrieving the cache device and spare eventually. Passing
ZFS_IMPORT_MISSING_LOG to spa_tryimport() makes it fetch the correct
configuration regardless of the missing log device.
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ameer Hamza <[email protected]>
Closes #14794
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/spa.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/module/zfs/spa.c b/module/zfs/spa.c index dd4a442d9..c2a67fbc7 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -6378,6 +6378,16 @@ spa_tryimport(nvlist_t *tryconfig) spa->spa_config_source = SPA_CONFIG_SRC_SCAN; } + /* + * spa_import() relies on a pool config fetched by spa_try_import() + * for spare/cache devices. Import flags are not passed to + * spa_tryimport(), which makes it return early due to a missing log + * device and missing retrieving the cache device and spare eventually. + * Passing ZFS_IMPORT_MISSING_LOG to spa_tryimport() makes it fetch + * the correct configuration regardless of the missing log device. + */ + spa->spa_import_flags |= ZFS_IMPORT_MISSING_LOG; + error = spa_load(spa, SPA_LOAD_TRYIMPORT, SPA_IMPORT_EXISTING); /* |