Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751621AbdIKLpj (ORCPT ); Mon, 11 Sep 2017 07:45:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:32898 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751532AbdIKLpi (ORCPT ); Mon, 11 Sep 2017 07:45:38 -0400 Date: Mon, 11 Sep 2017 13:45:35 +0200 From: Petr Mladek To: Rob Landley Cc: Michael Ellerman , Yury Norov , Andrew Morton , "linux-kernel@vger.kernel.org" , Prarit Bhargava , Yang Shi , Rasmus Villemoes , Kees Cook , Emese Revfy , Fabian Frederick , Linus Torvalds , Sergey Senozhatsky Subject: Re: Patch 0727d35de ("Make initramfs honor CONFIG_DEVTMPFS_MOUNT") breaks boot Message-ID: <20170911114535.GL8741@pathway.suse.cz> References: <20170522120550.ekrq6ipfmkdtlxjo@yury-N73SV> <7d91fb6b-9a21-ceb6-6c08-4bc14a15ada2@landley.net> <20170523080159.2yetdh4qqt2pmha6@yury-N73SV> <66dd96ec-b170-0bf6-7746-5466270b3e15@landley.net> <87fufta2gi.fsf@concordia.ellerman.id.au> <1fb53a8c-6c17-1de2-493c-0bff403c9ff9@landley.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1fb53a8c-6c17-1de2-493c-0bff403c9ff9@landley.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2494 Lines: 67 On Sun 2017-09-10 18:43:24, Rob Landley wrote: > On 05/25/2017 01:13 AM, Michael Ellerman wrote: > > Hi Rob, > > > > This is breaking a bunch of my powerpc boxes, for the exact same > > reason, they use a config that has DEVTMPFS_MOUNT=y and that trips > > up the initramfs. > > I've continued to use this locally but should probably make another > stab at submitting upstream. The obvious workaround until debian fixes > its 100% obvious bug seems to be: > > diff --git a/fs/namespace.c b/fs/namespace.c > index f8893dc..f57d5df 100644 > --- a/fs/namespace.c > +++ b/fs/namespace.c > @@ -2417,7 +2417,17 @@ static int do_add_mount(struct mount *newmnt, struct path *path, int mnt_flags) > err = -EBUSY; > if (path->mnt->mnt_sb == newmnt->mnt.mnt_sb && > path->mnt->mnt_root == path->dentry) > + { > + if (IS_ENABLED(CONFIG_DEVTMPFS_MOUNT) && > + !strcmp(path->mnt->mnt_sb->s_type->name, "devtmpfs")) > + { > + printk(KERN_WARNING "Debian bug workaround for devtmpfs overmount."); > + printk(KERN_WARNING "This line doesn't output for some reason."); > + > + err = 0; > + } > goto unlock; > + } > > err = -EINVAL; > if (d_is_symlink(newmnt->mnt.mnt_root)) > > Except for the second printk line: If you boot with rdinit=/bin/hush > then the first time you mount -t devtmpfs /dev /dev after boot (with > CONFIG_DEVTMPFS_MOUNT already having mounted it), you get the 0 return > value but the last printk() doesn't output? The second and later times > you repeat it, both printk() lines are output. > > What's up with printk? > > (I added the second printk because the _first_ one wasn't outputting > that first time. Something is happening to flush the printk() queue > instead of writing it out? You need to add "\n" at the end of the line. Otherwise, it expects that the message would continue and puts it into a cont buffer. The buffer is flushed only when another non-continuous message is added. This problem is more visible since the commit 5c2992ee7fd8a29d0412 ("printk: remove console flushing special cases for partial buffered lines"). Hmm, Linus wanted to add a timer that would always flush the cont buffer in a reasonable time frame. But there was a risk of deadlocks because of circular timer<->printk dependency, so it never happened. Maybe, we could setup the timer via an irq_work. We already use this trick for flushing deferred printk and waking klogd. It is not nice but it would be easier than the previous mess. Best Regards, Petr