From e19dec32a72644fcb2fc7c5327b2ad212a3aa10a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 18 May 2010 16:13:10 -0700 Subject: [PATCH 1/2] Minor fix from linux-legacy branch. Fold in a minor fix from the removed linux-legacy branch to skip checking character devices in /dev/ during import. Under Linux pread() may simply block when reading from these devices causing the import to hang. --- lib/libzfs/libzfs_import.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c index fa5aca0d8c..3b0c813ada 100644 --- a/lib/libzfs/libzfs_import.c +++ b/lib/libzfs/libzfs_import.c @@ -948,11 +948,10 @@ zpool_find_import_impl(libzfs_handle_t *hdl, int argc, char **argv, /* * Ignore failed stats. We only want regular - * files, character devs and block devs. + * files and block devs. */ if (fstat64(fd, &statbuf) != 0 || (!S_ISREG(statbuf.st_mode) && - !S_ISCHR(statbuf.st_mode) && !S_ISBLK(statbuf.st_mode))) { (void) close(fd); continue; From d28ada9eaaa3676073cf3b3073597bedf70d11b1 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 18 May 2010 16:15:57 -0700 Subject: [PATCH 2/2] Remove explicit import from zconfig test 1. Due to now resolved bug in the SPL you would need to explicitly import you zpools after module load. Now that is no longer the case. If a cache file is found your pool will be automatically loaded and available so I'm removing the explicit imports from the test case. --- scripts/zconfig.sh | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/scripts/zconfig.sh b/scripts/zconfig.sh index 52dfc6897a..55e4c46453 100755 --- a/scripts/zconfig.sh +++ b/scripts/zconfig.sh @@ -64,20 +64,16 @@ zconfig_test1() { ${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 || fail 2 ${ZPOOL} status ${POOL_NAME} >${TMP_FILE1} || fail 3 - # Unload/load the module stack to clear any configuration state - # then verify the pool is defined in the cache file, it can be - # imported without error, and it matches the original pool. + # 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} | grep ${POOL_NAME} >/dev/null||fail 6 - ${ZPOOL} import -c ${TMP_CACHE} ${POOL_NAME} || fail 7 - ${ZPOOL} status ${POOL_NAME} >${TMP_FILE2} || fail 8 - cmp ${TMP_FILE1} ${TMP_FILE2} || fail 9 + ${ZPOOL} status ${POOL_NAME} >${TMP_FILE2} || fail 6 + cmp ${TMP_FILE1} ${TMP_FILE2} || fail 7 # Cleanup the test pool and temporary files - ${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 -d || fail 10 - rm -f ${TMP_FILE1} ${TMP_FILE2} ${TMP_CACHE} || fail 11 - ${ZFS_SH} -u || fail 12 + ${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 -d || fail 8 + rm -f ${TMP_FILE1} ${TMP_FILE2} ${TMP_CACHE} || fail 9 + ${ZFS_SH} -u || fail 10 pass } @@ -97,9 +93,9 @@ zconfig_test2() { ${ZPOOL_CREATE_SH} -p ${POOL_NAME} -c lo-raidz2 || fail 2 ${ZPOOL} status ${POOL_NAME} >${TMP_FILE1} || fail 3 - # Unload/load the module stack to clear any configuration state - # then remove the cache file, probe the disks for pools, import - # the pool without error, and match it against the original pool. + # Unload the module stack, remove the cache file, load the module + # stack and attempt to probe the disks to import the pool. As + # a cross check verify the old pool state against the imported. ${ZFS_SH} -u || fail 4 rm -f ${TMP_CACHE} || fail 5 ${ZFS_SH} zfs="spa_config_path=${TMP_CACHE}" || fail 6