From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752119AbbE0X1v (ORCPT ); Wed, 27 May 2015 19:27:51 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59006 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751249AbbE0X1u (ORCPT ); Wed, 27 May 2015 19:27:50 -0400 Date: Wed, 27 May 2015 16:27:49 -0700 From: Andrew Morton To: Vishnu Pratap Singh Cc: paul.gortmaker@windriver.com, snitzer@redhat.com, dehrenberg@chromium.org, pavel@ucw.cz, mszeredi@suse.cz, linux-kernel@vger.kernel.org, cpgs@samsung.com Subject: Re: [PATCHv2] init/do_mounts: Add create_dev() failure log Message-Id: <20150527162749.60e3f39da22753b1c011f4a1@linux-foundation.org> In-Reply-To: <1432621618-9567-1-git-send-email-vishnu.ps@samsung.com> References: <1432531070-4262-1-git-send-email-vishnu.ps@samsung.com> <1432621618-9567-1-git-send-email-vishnu.ps@samsung.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 26 May 2015 11:56:58 +0530 Vishnu Pratap Singh wrote: > if create_dev() function fails to create the root mount device (/dev/root), > then it goes to panic as root device not found but there is no check/log > present in case of failure, So i have added the log in case it fails to > create the root device. It will help in debugging. > > ... > > --- a/init/do_mounts.c > +++ b/init/do_mounts.c > @@ -532,7 +532,8 @@ void __init mount_root(void) > } > #endif > #ifdef CONFIG_BLOCK > - create_dev("/dev/root", ROOT_DEV); > + if (create_dev("/dev/root", ROOT_DEV) < 0) > + pr_err("Failed to create %s device !\n", "/dev/root"); That's a pretty strange use of printk. And KERN_EMERG seems more appropriate when this happens. And we may as well let the poor user know why the mknod failed. This? --- a/init/do_mounts.c~init-do_mounts-add-create_dev-failure-log-fix +++ a/init/do_mounts.c @@ -533,9 +533,13 @@ void __init mount_root(void) } #endif #ifdef CONFIG_BLOCK - if (create_dev("/dev/root", ROOT_DEV) < 0) - pr_err("Failed to create %s device !\n", "/dev/root"); - mount_block_root("/dev/root", root_mountflags); + { + int err = create_dev("/dev/root", ROOT_DEV); + + if (err < 0) + pr_emerg("Failed to create /dev/root: %d\n", err); + mount_block_root("/dev/root", root_mountflags); + } #endif } _