mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
Call zvol_create_minors() in spa_open_common() when initializing pool
There is an extremely odd bug that causes zvols to fail to appear on some systems, but not others. Recently, I was able to consistently reproduce this issue over a period of 1 month. The issue disappeared after I applied this change from FreeBSD. This is from FreeBSD's pool version 28 import, which occurred in revision 219089. Ported-by: Richard Yao <ryao@cs.stonybrook.edu> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #441 Issue #599
This commit is contained in:
parent
c76955eaa5
commit
526af78550
@ -64,6 +64,7 @@
|
|||||||
#include <sys/zfs_ioctl.h>
|
#include <sys/zfs_ioctl.h>
|
||||||
#include <sys/dsl_scan.h>
|
#include <sys/dsl_scan.h>
|
||||||
#include <sys/zfeature.h>
|
#include <sys/zfeature.h>
|
||||||
|
#include <sys/zvol.h>
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
#include <sys/bootprops.h>
|
#include <sys/bootprops.h>
|
||||||
@ -2856,6 +2857,7 @@ spa_open_common(const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy,
|
|||||||
spa_load_state_t state = SPA_LOAD_OPEN;
|
spa_load_state_t state = SPA_LOAD_OPEN;
|
||||||
int error;
|
int error;
|
||||||
int locked = B_FALSE;
|
int locked = B_FALSE;
|
||||||
|
int firstopen = B_FALSE;
|
||||||
|
|
||||||
*spapp = NULL;
|
*spapp = NULL;
|
||||||
|
|
||||||
@ -2879,6 +2881,8 @@ spa_open_common(const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy,
|
|||||||
if (spa->spa_state == POOL_STATE_UNINITIALIZED) {
|
if (spa->spa_state == POOL_STATE_UNINITIALIZED) {
|
||||||
zpool_rewind_policy_t policy;
|
zpool_rewind_policy_t policy;
|
||||||
|
|
||||||
|
firstopen = B_TRUE;
|
||||||
|
|
||||||
zpool_get_rewind_policy(nvpolicy ? nvpolicy : spa->spa_config,
|
zpool_get_rewind_policy(nvpolicy ? nvpolicy : spa->spa_config,
|
||||||
&policy);
|
&policy);
|
||||||
if (policy.zrp_request & ZPOOL_DO_REWIND)
|
if (policy.zrp_request & ZPOOL_DO_REWIND)
|
||||||
@ -2953,6 +2957,11 @@ spa_open_common(const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy,
|
|||||||
mutex_exit(&spa_namespace_lock);
|
mutex_exit(&spa_namespace_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
if (firstopen)
|
||||||
|
zvol_create_minors(spa->spa_name);
|
||||||
|
#endif
|
||||||
|
|
||||||
*spapp = spa;
|
*spapp = spa;
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
@ -4010,6 +4019,10 @@ spa_import(const char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags)
|
|||||||
mutex_exit(&spa_namespace_lock);
|
mutex_exit(&spa_namespace_lock);
|
||||||
spa_history_log_version(spa, LOG_POOL_IMPORT);
|
spa_history_log_version(spa, LOG_POOL_IMPORT);
|
||||||
|
|
||||||
|
#ifdef _KERNEL
|
||||||
|
zvol_create_minors(pool);
|
||||||
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1268,9 +1268,6 @@ zfs_ioc_pool_import(zfs_cmd_t *zc)
|
|||||||
error = err;
|
error = err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error == 0)
|
|
||||||
zvol_create_minors(zc->zc_name);
|
|
||||||
|
|
||||||
nvlist_free(config);
|
nvlist_free(config);
|
||||||
|
|
||||||
if (props)
|
if (props)
|
||||||
|
Loading…
Reference in New Issue
Block a user