lkml.org 
[lkml]   [2004]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH RESEND] Don't remove /sys in initramfs
From
Date
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 <juerg@paldo.org>

diff -upNr linux-2.6.10-rc1-bk15.orig/init/do_mounts.c linux-2.6.10-rc1-bk15/init/do_mounts.c
--- linux-2.6.10-rc1-bk15.orig/init/do_mounts.c 2004-10-18 23:53:51.000000000 +0200
+++ linux-2.6.10-rc1-bk15/init/do_mounts.c 2004-11-05 16:24:17.816549948 +0100
@@ -142,7 +142,7 @@ dev_t __init name_to_dev_t(char *name)
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 @@ done:
#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/

\
 
 \ /
  Last update: 2005-03-22 14:07    [W:0.121 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site