Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262650AbUJ1URi (ORCPT ); Thu, 28 Oct 2004 16:17:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262446AbUJ1UQ0 (ORCPT ); Thu, 28 Oct 2004 16:16:26 -0400 Received: from paldo.org ([213.202.245.43]:51861 "EHLO buildd1.paldo.org") by vger.kernel.org with ESMTP id S262893AbUJ1UGB (ORCPT ); Thu, 28 Oct 2004 16:06:01 -0400 Subject: [PATCH] Don't remove /sys in initramfs From: Juerg Billeter To: linux-kernel@vger.kernel.org Cc: torvalds@osdl.org Content-Type: text/plain Organization: paldo Date: Thu, 28 Oct 2004 22:05:56 +0200 Message-Id: <1098993956.4570.10.camel@juerg-p4.bitron.ch> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1420 Lines: 48 Hi Using the "resume" kernel parameter together with an initramfs revealed a bug that causes removal of the /sys directory in the initramfs' tmpfs, making the system unbootable. The source of the problem is that the try_name() function removes the /sys directory unconditionally, instead of removing it only when it has been created by try_name(). The attached patch only removes /sys if it has been created before. Please CC me, I'm not on lkml. Juerg -- Signed-off-by: Juerg Billeter diff -uNr linux-2.6.9.orig/init/do_mounts.c linux-2.6.9/init/do_mounts.c --- linux-2.6.9.orig/init/do_mounts.c 2004-10-18 23:53:51.000000000 +0200 +++ linux-2.6.9/init/do_mounts.c 2004-10-28 19:04:10.803026647 +0200 @@ -142,7 +142,7 @@ int part; #ifdef CONFIG_SYSFS - sys_mkdir("/sys", 0700); + int mkdir_err = sys_mkdir("/sys", 0700); if (sys_mount("sysfs", "/sys", "sysfs", 0, NULL) < 0) goto out; #endif @@ -197,7 +197,8 @@ #ifdef CONFIG_SYSFS sys_umount("/sys", 0); out: - sys_rmdir("/sys"); + if (!mkdir_err) + sys_rmdir("/sys"); #endif return res; fail: - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/