Re: initramfs: Always do fput() and load modules after rootfs populate

From: Stafford Horne
Date: Sat May 06 2017 - 04:25:48 EST


On Sat, May 06, 2017 at 05:17:04PM +0900, Stafford Horne wrote:
> On Sat, May 06, 2017 at 12:02:32AM -0700, Andrei Vagin wrote:
> > Hi,
> >
> > I see the following error with this patch:
> >
> > init/initramfs.c: In function 'populate_rootfs':
> > init/initramfs.c:644:2: error: label at end of compound statement
> > done:
> > ^
> > scripts/Makefile.build:294: recipe for target 'init/initramfs.o' failed
> > make[1]: *** [init/initramfs.o] Error 1
>
> Ahh, I didnt notice this and none of the build robots reported to us.
> Sorry about it, the above patch is already merged, so this is not good, Ill
> get this fixed.
>
> Could you give me some info on your compiler?

Nvermind, I was able to reproduce enabling:

CONFIG_BLK_DEV_RAM=y

I should have run my allyesconfig testing, instead of just the defconfig!

-Stafford

> > probably we need something like this:
> > diff --git a/init/initramfs.c b/init/initramfs.c
> > index 3a68715..9966c0f 100644
> > --- a/init/initramfs.c
> > +++ b/init/initramfs.c
> > @@ -641,7 +641,6 @@ static int __init populate_rootfs(void)
> > sys_close(fd);
> > free_initrd();
> > }
> > - done:
> > #else
> > printk(KERN_INFO "Unpacking initramfs...\n");
> > err = unpack_to_rootfs((char *)initrd_start,
> > @@ -651,6 +650,7 @@ static int __init populate_rootfs(void)
> > free_initrd();
> > #endif
> > }
> > +done:
> > flush_delayed_fput();
> > /*
> > * Try loading default modules from initramfs. This gives
> >
>
> Right, this looks correct for the above error.
>
> -Stafford