Commit a841c673 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

revert "initramfs: cleanup incomplete rootfs"

Revert ff1522bb ("initramfs: cleanup incomplete rootfs").

Andy reports

: This breaks my setup where I have U-boot provided more size of initramfs
: than needed.  This allows a bit of flexibility to increase or decrease
: initramfs compressed image without taking care of bootloader.  The proper
: solution is to do this if we sure that we didn't get enough memory,
: otherwise I can't consider the error fatal to clean up rootfs.

Fixes: ff1522bb ("initramfs: cleanup incomplete rootfs")
Reported-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Cc: David Engraf <david.engraf@sysgo.com>
Cc: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2137397c
...@@ -550,6 +550,7 @@ static void __init free_initrd(void) ...@@ -550,6 +550,7 @@ static void __init free_initrd(void)
initrd_end = 0; initrd_end = 0;
} }
#ifdef CONFIG_BLK_DEV_RAM
#define BUF_SIZE 1024 #define BUF_SIZE 1024
static void __init clean_rootfs(void) static void __init clean_rootfs(void)
{ {
...@@ -596,6 +597,7 @@ static void __init clean_rootfs(void) ...@@ -596,6 +597,7 @@ static void __init clean_rootfs(void)
ksys_close(fd); ksys_close(fd);
kfree(buf); kfree(buf);
} }
#endif
static int __init populate_rootfs(void) static int __init populate_rootfs(void)
{ {
...@@ -638,10 +640,8 @@ static int __init populate_rootfs(void) ...@@ -638,10 +640,8 @@ static int __init populate_rootfs(void)
printk(KERN_INFO "Unpacking initramfs...\n"); printk(KERN_INFO "Unpacking initramfs...\n");
err = unpack_to_rootfs((char *)initrd_start, err = unpack_to_rootfs((char *)initrd_start,
initrd_end - initrd_start); initrd_end - initrd_start);
if (err) { if (err)
printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err); printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
clean_rootfs();
}
free_initrd(); free_initrd();
#endif #endif
} }
......
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