]> granicus.if.org Git - zfs/commitdiff
Set zfs_autoimport_disable default value to 1
authorDan Swartzendruber <dswartz@druber.com>
Thu, 9 Oct 2014 20:45:46 +0000 (16:45 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 18 Feb 2015 00:09:41 +0000 (16:09 -0800)
When loading the ZFS kernel modules they should not populate the
spa namespace using the cache file.  This behavior isn't consistent
with other Linux kernel modules and we need to move away from it.
Removing this makes the whole startup process predictable with four
basic steps which are driven by the init system.

1) modprobe
2) zpool import
3) zfs mount
4) zfs share

This change also helps lay the groundwork for eventually removing
the kobj_* compatibility code on the kernel side.  It may need to
be preserved in userspace because libzfs_init() depends on it.
This is why the conditional must be wrapped with an #ifdef _KERNEL.

Signed-off-by: Dan Swartzendruber <dswartz@druber.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2820

module/zfs/spa_config.c
scripts/zconfig.sh

index ed2344cf39de8dc644c0db0f684fa0a0752fefb4..624bcb7887f36d320ce4fc344fa4633315052c41 100644 (file)
@@ -64,7 +64,7 @@ static uint64_t spa_config_generation = 1;
  * userland pools when doing testing.
  */
 char *spa_config_path = ZPOOL_CACHE;
-int zfs_autoimport_disable = 0;
+int zfs_autoimport_disable = 1;
 
 /*
  * Called when the module is first loaded, this routine loads the configuration
@@ -81,8 +81,10 @@ spa_config_load(void)
        struct _buf *file;
        uint64_t fsize;
 
+#ifdef _KERNEL
        if (zfs_autoimport_disable)
                return;
+#endif
 
        /*
         * Open the configuration file.
index d6695be7239043ad4ae7abbb4f81288c9f4d77f4..45ccf62ed02baaff3025ac56c1e53cee92bf0848 100755 (executable)
@@ -96,6 +96,7 @@ test_1() {
        # Unload/load the module stack and verify the pool persists.
        ${ZFS_SH} -u || fail 4
        ${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 5
+       ${ZPOOL} import -c ${TMP_CACHE} ${POOL_NAME} || fail 5
        ${ZPOOL} status ${POOL_NAME} >${TMP_FILE2} || fail 6
        cmp ${TMP_FILE1} ${TMP_FILE2} || fail 7
 
@@ -126,8 +127,7 @@ test_2() {
        ${ZFS_SH} -u || fail 4
        rm -f ${TMP_CACHE} || fail 5
        ${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 6
-       ${ZPOOL} import | grep ${POOL_NAME} >/dev/null || fail 7
-       ${ZPOOL} import -f ${POOL_NAME} || fail 8
+       ${ZPOOL} import -d /dev ${POOL_NAME} || fail 8
        ${ZPOOL} status ${POOL_NAME} >${TMP_FILE2} || fail 9
        cmp ${TMP_FILE1} ${TMP_FILE2} || fail 10
 
@@ -266,6 +266,7 @@ test_4() {
 
        # Load the modules, list the pools to ensure they are opened
        ${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 10
+       ${ZPOOL} import -c ${TMP_CACHE} ${POOL_NAME} || fail 10
        ${ZPOOL} list &>/dev/null
 
        # Verify the devices were created