aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorTurbo Fredriksson <turbo@bayour.com>2015-07-27 15:09:02 +0000
committerBrian Behlendorf <behlendorf1@llnl.gov>2015-07-28 20:29:28 +0000
commit21d41d6806edce8217dfd5d16e74a6a8a4f5fe1b (patch)
tree5b310d1bcc0b2e2fe68cbe2bf2aa904546f87f25 /contrib
parent48511ea6454224bc96ac518501a89ba52d7a5102 (diff)
downloadsrc-21d41d6806edce8217dfd5d16e74a6a8a4f5fe1b.tar.gz
src-21d41d6806edce8217dfd5d16e74a6a8a4f5fe1b.zip
Diffstat (limited to 'contrib')
-rw-r--r--contrib/initramfs/scripts/zfs27
1 files changed, 17 insertions, 10 deletions
diff --git a/contrib/initramfs/scripts/zfs b/contrib/initramfs/scripts/zfs
index dc01db11ea7f..8cdef0b54201 100644
--- a/contrib/initramfs/scripts/zfs
+++ b/contrib/initramfs/scripts/zfs
@@ -64,13 +64,13 @@ find_rootfs()
{
local pool="$1"
+ # If 'POOL_IMPORTED' isn't set, no pool imported and therefor
+ # we won't be able to find a root fs.
+ [ -z "${POOL_IMPORTED}" ] && return 1
+
# If it's already specified, just keep it mounted and exit
# User (kernel command line) must be correct.
- if [ -n "${ZFS_BOOTFS}" ]
- then
- POOL_IMPORTED=1
- return 0
- fi
+ [ -n "${ZFS_BOOTFS}" ] && return 0
# Not set, try to find it in the 'bootfs' property of the pool.
# NOTE: zpool does not support 'get -H -ovalue bootfs'...
@@ -87,6 +87,7 @@ find_rootfs()
# Not boot fs here, export it and later try again..
"${ZPOOL}" export "$pool"
+ POOL_IMPORTED=""
return 1
}
@@ -229,12 +230,16 @@ import_pool()
then
[ "$quiet" != "y" ] && zfs_log_failure_msg "${ZFS_ERROR}"
- [ "$quiet" != "y" ] && zfs_log_begin_msg \
- "Importing pool '${pool}' using cachefile."
+ if [ -f "${ZPOOL_CACHE}" ]
+ then
+ [ "$quiet" != "y" ] && zfs_log_begin_msg \
+ "Importing pool '${pool}' using cachefile."
+
+ ZFS_CMD="${ZPOOL} import -c ${ZPOOL_CACHE} -N ${ZPOOL_FORCE}"
+ ZFS_STDERR="$($ZFS_CMD "$pool" 2>&1)"
+ ZFS_ERROR="$?"
+ fi
- ZFS_CMD="${ZPOOL} import -c ${ZPOOL_CACHE} -N ${ZPOOL_FORCE}"
- ZFS_STDERR="$($ZFS_CMD "$pool" 2>&1)"
- ZFS_ERROR="$?"
if [ "${ZFS_ERROR}" != 0 ]
then
[ "$quiet" != "y" ] && zfs_log_failure_msg "${ZFS_ERROR}"
@@ -252,6 +257,8 @@ import_pool()
fi
[ "$quiet" != "y" ] && zfs_log_end_msg
+
+ POOL_IMPORTED=1
return 0
}