1 |
commit: 7b805055ce3b1f211ae64905d2ee7d8898e880fd |
2 |
Author: Richard Yao <ryao <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Sep 20 19:29:35 2015 +0000 |
4 |
Commit: Richard Yao <ryao <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Sep 20 19:29:35 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=7b805055 |
7 |
|
8 |
Further ZFS boot improvements |
9 |
|
10 |
Signed-off-by: Richard Yao <ryao <AT> gentoo.org> |
11 |
|
12 |
defaults/initrd.scripts | 14 +++++++++++++- |
13 |
1 file changed, 13 insertions(+), 1 deletion(-) |
14 |
|
15 |
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts |
16 |
index 9c0c290..d1bb0bc 100644 |
17 |
--- a/defaults/initrd.scripts |
18 |
+++ b/defaults/initrd.scripts |
19 |
@@ -1034,10 +1034,22 @@ startVolumes() { |
20 |
elif [ -z "${ZFS_POOL}" ] |
21 |
then |
22 |
bad_msg "Please boot with root=ZFS=\$DATASET" |
23 |
+ # startVolumes is called twice for LUKS assembly. |
24 |
+ # Devices are not accessed until mount, so become a no-op. |
25 |
+ # We fall through from the waitForZFS call rather than stopping |
26 |
+ # sooner so that initramfs archives where the zpool.cache file |
27 |
+ # has been included are protected against races. |
28 |
+ elif [ -f /etc/zfs/zpool.cache ] |
29 |
+ then |
30 |
+ : |
31 |
elif /sbin/zpool import -f -N -o readonly=on "${ZFS_POOL}" 2>&1 >/dev/null |
32 |
then |
33 |
mkdir -p /tmp/zfs |
34 |
- mount -o ro,zfsutil -t zfs "${REAL_ROOT#*=}" /tmp/zfs |
35 |
+ /sbin/mount.zfs -o ro,zfsutil "${REAL_ROOT#*=}" /tmp/zfs 2>&1 >/dev/null |
36 |
+ if [ $? -ne 0 ] |
37 |
+ bad_msg "Failed to mount ${REAL_ROOT#*=}" |
38 |
+ return 1 |
39 |
+ fi |
40 |
|
41 |
# Copy important files to /etc/zfs |
42 |
for i in zpool.cache zdev.conf |