diff options
author | Richard Yao <ryao@gentoo.org> | 2013-06-09 09:13:58 -0400 |
---|---|---|
committer | Richard Yao <ryao@cs.stonybrook.edu> | 2013-06-09 09:56:14 -0400 |
commit | 2fa0a9beaa069a61f907f0b06c9bd6abeddb1ca7 (patch) | |
tree | 2919aa92c52119c620d4a5e97ca69b3343e9f57f | |
parent | Import pool after ZFS module finishes loading (diff) | |
download | genkernel-2fa0a9beaa069a61f907f0b06c9bd6abeddb1ca7.tar.gz genkernel-2fa0a9beaa069a61f907f0b06c9bd6abeddb1ca7.tar.bz2 genkernel-2fa0a9beaa069a61f907f0b06c9bd6abeddb1ca7.zip |
Workaround busybox modprobe's inability to load ZFS modules
Commit 3a054014e880e5b1ff28e3d87767c45a073da6b5 replaced our modprobe
with busybox's modprobe. Unfortunately, busybox's modprobe appears to be
unable to properly load modules with more than 1 level of dependencies.
The zfs and zpool commands will invoke modprobe if /dev/zvol is missing,
which concealed this problem. However, this caused problems because some
invocations would fail and under certain circumstances, init would be
killed, causing a kernel panic. This issue was made clear by commit
c812c35100771bb527f6b03853fa6d8ef66a48fe, which ensured that the zpool
and zfs commands were not run until the ZFS module was loaded.
busybox modprobe's failure to load module dependencies correctly appears
to occur because busybox modprobe does not wait until until a module is
loaded before loading a module that depends on it, which is a race. It
would be best to correct this race by waiting until the module has
properly loaded, but it is not clear that the race is the only thing
going wrong and developer time is a premium.
We implement a workaround by modifying the busy loop added in the
previous commit to explicit call `modprobe zfs` on each iteration. While
the first few calls fail due to bugs in busybox modprobe, it will
eventually work, after which each call is a noop. This lets us keep
looping until either the loop exit condition that /dev/zvol exist is
reached or the 5 second timeout is reached.
Once the busybox modprobe issue is fixed, this workaround should be safe
to revert.
Signed-off-by: Richard Yao <ryao@gentoo.org>
-rw-r--r-- | defaults/initrd.scripts | 5 | ||||
-rw-r--r-- | defaults/linuxrc | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 35e5957..cb0fcb8 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -637,9 +637,10 @@ chooseKeymap() { } # This helper function is to be called using call_func_timeout. -# It enables us to wait a reasonable amount of time until /dev/zfs appears. +# This works around the inability of busybox modprobe to handle complex module dependencies. +# This also enables us to wait a reasonable amount of time until /dev/zfs appears. waitForZFS() { - while [ ! -c /dev/zfs ]; do echo >/dev/null; done; + while [ ! -c /dev/zfs ]; do modprobe zfs 2> /dev/null; done; } startVolumes() { diff --git a/defaults/linuxrc b/defaults/linuxrc index 3784456..d6d0eaa 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -307,8 +307,6 @@ then break fi done - - [ "USE_ZFS" = "1" ] && MY_HWOPTS="${MY_HWOPTS} zfs" fi splash 'init' |