From patchwork Fri Sep 12 19:08:23 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geoff Levand X-Patchwork-Id: 262 Return-Path: X-Original-To: patchwork@ozlabs.org Delivered-To: patchwork@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 33716DE1AC for ; Sat, 13 Sep 2008 05:08:52 +1000 (EST) X-Original-To: cbe-oss-dev@ozlabs.org Delivered-To: cbe-oss-dev@ozlabs.org Received: from IE1EHSOBE004.bigfish.com (outbound-dub.frontbridge.com [213.199.154.16]) by ozlabs.org (Postfix) with ESMTP id 0ACB3DE025 for ; Sat, 13 Sep 2008 05:08:33 +1000 (EST) Received: from mail118-dub-R.bigfish.com (10.5.252.3) by IE1EHSOBE004.bigfish.com (10.5.252.24) with Microsoft SMTP Server id 8.1.291.1; Fri, 12 Sep 2008 19:08:29 +0000 Received: from mail118-dub (localhost.localdomain [127.0.0.1]) by mail118-dub-R.bigfish.com (Postfix) with ESMTP id 717F0BF0170; Fri, 12 Sep 2008 19:08:28 +0000 (UTC) X-BigFish: VPS1(zzzz10d3izzz2fh6bh61h) X-Spam-TCS-SCL: 0:0 Received: by mail118-dub (MessageSwitch) id 1221246506982146_4996; Fri, 12 Sep 2008 19:08:26 +0000 (UCT) Received: from mail8.fw-sd.sony.com (mail8.fw-sd.sony.com [160.33.66.75]) by mail118-dub.bigfish.com (Postfix) with ESMTP id CCDF0860071; Fri, 12 Sep 2008 19:08:25 +0000 (UTC) Received: from mail3.sjc.in.sel.sony.com (mail3.sjc.in.sel.sony.com [43.134.1.211]) by mail8.fw-sd.sony.com (8.14.2/8.14.2) with ESMTP id m8CJ8OK0025888; Fri, 12 Sep 2008 19:08:24 GMT Received: from USSDIXIM02.am.sony.com (ussdixim02.am.sony.com [43.130.140.34]) by mail3.sjc.in.sel.sony.com (8.12.11/8.12.11) with ESMTP id m8CJ8OqN025833; Fri, 12 Sep 2008 19:08:24 GMT Received: from ussdixms03.am.sony.com ([43.130.140.23]) by USSDIXIM02.am.sony.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 12 Sep 2008 12:08:24 -0700 Received: from [192.168.1.10] ([43.135.148.226]) by ussdixms03.am.sony.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 12 Sep 2008 12:08:23 -0700 Message-ID: <48CABE27.10301@am.sony.com> Date: Fri, 12 Sep 2008 12:08:23 -0700 From: Geoff Levand User-Agent: Thunderbird 2.0.0.16 (X11/20080723) MIME-Version: 1.0 To: Simon Horman X-Enigmail-Version: 0.95.7 X-OriginalArrivalTime: 12 Sep 2008 19:08:23.0663 (UTC) FILETIME=[ED9597F0:01C9150A] X-SEL-encryption-scan: scanned Cc: kexec@lists.infradead.org, Cell Broadband Engine OSS Development Subject: [Cbe-oss-dev] [patch kexec] Fix test for loaded kernel X-BeenThere: cbe-oss-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Discussion about Open Source Software for the Cell Broadband Engine List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: cbe-oss-dev-bounces+patchwork=ozlabs.org@ozlabs.org Errors-To: cbe-oss-dev-bounces+patchwork=ozlabs.org@ozlabs.org Fix these reboot errors with NFS mounted root filesystems: nfs: server 192.168.1.1 not responding, still trying The main kexec code that uses kexec_loaded() expects a non-zero return to mean a kexec kernel has been loaded for execution. Here is the current check: if ((result == 0) && (do_shutdown || do_exec) && !kexec_loaded()) die In cases where the currently running kernel does not have kexec enabled, or in cases where the distro init scripts (YDL, maybe others) have unmounted the sys filesystem prior to running kexec, the open of "/sys/kernel/kexec_loaded" will fail. This result should be returned as (0), meaning NOT LOADED. The current kexec_loaded() code returns (-1), meaning LOADED. With the current code, kexec will continue on. The next steps are to shutdown the network, then call sys_kexec. The shutdown of the network will succeed, but the call to sys_kexec will fail. In this case, control will pass back to the init scripts, but the network will be down. Systems with NFS mounted root filesystem cannot work in this state. Signed-off-by: Geoff Levand --- a/kexec/kexec.c +++ b/kexec/kexec.c @@ -805,7 +805,7 @@ static int kexec_loaded(void) fp = fopen("/sys/kernel/kexec_loaded", "r"); if (fp == NULL) - return -1; + return 0; fscanf(fp, "%d", &ret); fclose(fp); return ret;