[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdOSC8j_1G3z-UO01_JYN20M-YMGOC2JkFDhi8njNZAvA@mail.gmail.com>
Date: Fri, 8 Feb 2019 21:45:21 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: David Engraf <david.engraf@...go.com>
Cc: Dominik Brodowski <linux@...inikbrodowski.net>,
Andrew Morton <akpm@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Philippe Ombredanne <pombredanne@...b.com>,
Arnd Bergmann <arnd@...db.de>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RESEND] initramfs: cleanup incomplete rootfs
On Tue, Oct 30, 2018 at 5:22 PM David Engraf <david.engraf@...go.com> wrote:
>
> Unpacking an external initrd may fail e.g. not enough memory. This leads
> to an incomplete rootfs because some files might be extracted already.
> Fixed by cleaning the rootfs so the kernel is not using an incomplete
> rootfs.
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.
Andrew, what it be good idea to revert for now?
> Signed-off-by: David Engraf <david.engraf@...go.com>
> ---
> init/initramfs.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/init/initramfs.c b/init/initramfs.c
> index 640557788026..aa3a46cfcb4e 100644
> --- a/init/initramfs.c
> +++ b/init/initramfs.c
> @@ -548,7 +548,6 @@ static void __init free_initrd(void)
> initrd_end = 0;
> }
>
> -#ifdef CONFIG_BLK_DEV_RAM
> #define BUF_SIZE 1024
> static void __init clean_rootfs(void)
> {
> @@ -595,7 +594,6 @@ static void __init clean_rootfs(void)
> ksys_close(fd);
> kfree(buf);
> }
> -#endif
>
> static int __init populate_rootfs(void)
> {
> @@ -638,8 +636,10 @@ static int __init populate_rootfs(void)
> printk(KERN_INFO "Unpacking initramfs...\n");
> err = unpack_to_rootfs((char *)initrd_start,
> initrd_end - initrd_start);
> - if (err)
> + if (err) {
> printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
> + clean_rootfs();
> + }
> free_initrd();
> #endif
> }
> --
> 2.17.1
>
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists