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 28AFD138200 for ; Sun, 9 Jun 2013 13:57:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 020EAE0853; Sun, 9 Jun 2013 13:57:12 +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 73F34E0822 for ; Sun, 9 Jun 2013 13:57:11 +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 77E1B33DD01 for ; Sun, 9 Jun 2013 13:57:10 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 19C2BE468F for ; Sun, 9 Jun 2013 13:57:09 +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: <1370786174.2fa0a9beaa069a61f907f0b06c9bd6abeddb1ca7.ryao@gentoo> Subject: [gentoo-commits] proj/genkernel:master 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: 2fa0a9beaa069a61f907f0b06c9bd6abeddb1ca7 X-VCS-Branch: master Date: Sun, 9 Jun 2013 13:57:09 +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: b081182d-6621-47c3-9f1a-edcf0ddaae12 X-Archives-Hash: bf7562558528572989003677278eabdb commit: 2fa0a9beaa069a61f907f0b06c9bd6abeddb1ca7 Author: Richard Yao gentoo org> AuthorDate: Sun Jun 9 13:13:58 2013 +0000 Commit: Richard Yao gentoo org> CommitDate: Sun Jun 9 13:56:14 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=2fa0a9be 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 gentoo.org> --- defaults/initrd.scripts | 5 +++-- 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' 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 70F141381F3 for ; Sun, 9 Jun 2013 13:57:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 07A4DE0848; Sun, 9 Jun 2013 13:57:51 +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 6386AE0822 for ; Sun, 9 Jun 2013 13:57:50 +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 7EC7C33E360 for ; Sun, 9 Jun 2013 13:57:49 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 1FA2EE468F for ; Sun, 9 Jun 2013 13:57:48 +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: <1370786174.2fa0a9beaa069a61f907f0b06c9bd6abeddb1ca7.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: 2fa0a9beaa069a61f907f0b06c9bd6abeddb1ca7 X-VCS-Branch: ryao Date: Sun, 9 Jun 2013 13:57:48 +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: 8e9eacd1-efcc-45fc-b3fd-de246f7bf99a X-Archives-Hash: fc4f62b7fc1aca2cb9c402f75cc324e2 Message-ID: <20130609135748.fPOQYM_lC0YI1dT7wYPnXeqi2EOxUcRsuQlmpj04ggQ@z> commit: 2fa0a9beaa069a61f907f0b06c9bd6abeddb1ca7 Author: Richard Yao gentoo org> AuthorDate: Sun Jun 9 13:13:58 2013 +0000 Commit: Richard Yao gentoo org> CommitDate: Sun Jun 9 13:56:14 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=2fa0a9be 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 gentoo.org> --- defaults/initrd.scripts | 5 +++-- 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'