From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 795351381F3 for ; Sun, 9 Jun 2013 12:29:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0C405E080A; Sun, 9 Jun 2013 12:29:16 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9746CE0807 for ; Sun, 9 Jun 2013 12:29:15 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id ACCCF33E35D for ; Sun, 9 Jun 2013 12:29:14 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 51439E468F for ; Sun, 9 Jun 2013 12:29:13 +0000 (UTC) From: "Richard Yao" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Richard Yao" Message-ID: <1370780899.022336959eeb1b15b10c2d351432ee3dd68aacb7.ryao@gentoo> Subject: [gentoo-commits] proj/genkernel:ryao commit in: defaults/ X-VCS-Repository: proj/genkernel X-VCS-Files: defaults/initrd.scripts defaults/linuxrc X-VCS-Directories: defaults/ X-VCS-Committer: ryao X-VCS-Committer-Name: Richard Yao X-VCS-Revision: 022336959eeb1b15b10c2d351432ee3dd68aacb7 X-VCS-Branch: ryao Date: Sun, 9 Jun 2013 12:29:13 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: f8f4c82d-16b0-4e59-a9ed-1d5f877be4e9 X-Archives-Hash: 55ad299ceafaa38cf9d171a68a82d53e commit: 022336959eeb1b15b10c2d351432ee3dd68aacb7 Author: Richard Yao gentoo org> AuthorDate: Sun Jun 9 11:36:43 2013 +0000 Commit: Richard Yao gentoo org> CommitDate: Sun Jun 9 12:28:19 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=02233695 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. We prevent this by explicitly calling modprobe on each of the dependencies before attempting to import the pool. Signed-off-by: Richard Yao gentoo.org> --- defaults/initrd.scripts | 6 +++--- defaults/linuxrc | 19 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index f598402..340cc54 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() { @@ -720,7 +721,6 @@ startVolumes() { if [ "${USE_ZFS}" = '1' ] then - # Avoid race involving asynchronous module loading if call_func_timeout waitForZFS 5 then diff --git a/defaults/linuxrc b/defaults/linuxrc index 9ea305b..d6d0eaa 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -298,16 +298,15 @@ esac # Verify that it is safe to use ZFS if [ "USE_ZFS" = "1" ] then - if [ -x /sbin/zfs -a -x /sbin/zpool ] - then - MY_HWOPTS="${MY_HWOPTS} zfs" - else - USE_ZFS=0 - - [ -x /sbin/zfs ] || bad_msg '/sbin/zfs not found!' - [ -x /sbin/zpool ] || bad_msg '/sbin/zpool not found!' - bad_msg 'Aborting use of zfs!' - fi + for i in /sbin/zfs /sbin/zpool + do + if [ ! -x ${i} ] + then + USE_ZFS=0 + bad_msg 'Aborting use of zfs because ${i} not found!' + break + fi + done fi splash 'init'