Commit be6ab017 authored by Juerg Billeter's avatar Juerg Billeter Committed by Linus Torvalds

[PATCH] Don't remove /sys in initramfs

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.
Signed-off-by: default avatarJuerg Billeter <juerg@paldo.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ecbbaafb
......@@ -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,6 +197,7 @@ dev_t __init name_to_dev_t(char *name)
#ifdef CONFIG_SYSFS
sys_umount("/sys", 0);
out:
if (!mkdir_err)
sys_rmdir("/sys");
#endif
return res;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment