mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-26 11:47:31 +00:00
Fix kernel panic when calling spa_tryimport() on a corrupted pool.
OpenSolaris onnv revision: 8680:005fe27123ba Approved by: delphij (mentor) Obtained from: OpenSolaris (Bug ID 6786321) MFC after: 1 day
This commit is contained in:
parent
e3fffd1a9f
commit
55a381515b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=208443
@ -2478,6 +2478,7 @@ spa_tryimport(nvlist_t *tryconfig)
|
||||
char *poolname;
|
||||
spa_t *spa;
|
||||
uint64_t state;
|
||||
int error;
|
||||
|
||||
if (nvlist_lookup_string(tryconfig, ZPOOL_CONFIG_POOL_NAME, &poolname))
|
||||
return (NULL);
|
||||
@ -2497,7 +2498,7 @@ spa_tryimport(nvlist_t *tryconfig)
|
||||
* Pass TRUE for mosconfig because the user-supplied config
|
||||
* is actually the one to trust when doing an import.
|
||||
*/
|
||||
(void) spa_load(spa, tryconfig, SPA_LOAD_TRYIMPORT, B_TRUE);
|
||||
error = spa_load(spa, tryconfig, SPA_LOAD_TRYIMPORT, B_TRUE);
|
||||
|
||||
/*
|
||||
* If 'tryconfig' was at least parsable, return the current config.
|
||||
@ -2516,7 +2517,7 @@ spa_tryimport(nvlist_t *tryconfig)
|
||||
* copy it out so that external consumers can tell which
|
||||
* pools are bootable.
|
||||
*/
|
||||
if (spa->spa_bootfs) {
|
||||
if ((!error || error == EEXIST) && spa->spa_bootfs) {
|
||||
char *tmpname = kmem_alloc(MAXPATHLEN, KM_SLEEP);
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user