LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH -rc] init: don't panic if mount_nodev_root failed
@ 2021-09-14  9:12 Leon Romanovsky
  2021-09-14 15:07 ` Christoph Hellwig
  2021-09-19  5:46 ` Leon Romanovsky
  0 siblings, 2 replies; 5+ messages in thread
From: Leon Romanovsky @ 2021-09-14  9:12 UTC (permalink / raw)
  To: Al Viro, Christoph Hellwig; +Cc: Leon Romanovsky, linux-kernel, Jason Gunthorpe

From: Leon Romanovsky <leonro@nvidia.com>

Attempt to mount 9p file system as root gives the following kernel panic:

 9pnet_virtio: no channels available for device root
 Kernel panic - not syncing: VFS: Unable to mount root "root" (9p), err=-2
 CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc1+ #127
 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
 Call Trace:
  dump_stack_lvl+0x45/0x59
  panic+0x1e2/0x44b
  ? __warn_printk+0xf3/0xf3
  ? free_unref_page+0x2d4/0x4a0
  ? trace_hardirqs_on+0x32/0x120
  ? free_unref_page+0x2d4/0x4a0
  mount_root+0x189/0x1e0
  prepare_namespace+0x136/0x165
  kernel_init_freeable+0x3b8/0x3cb
  ? rest_init+0x2e0/0x2e0
  kernel_init+0x19/0x130
  ret_from_fork+0x1f/0x30
 Kernel Offset: disabled
 ---[ end Kernel panic - not syncing: VFS: Unable to mount root "root" (9p), err=-2 ]---

QEMU command line:
 "qemu-system-x86_64 -append root=/dev/root rw rootfstype=9p rootflags=trans=virtio ..."

This error is because root_device_name is truncated in prepare_namespace() from
being "/dev/root" to be "root" prior to call to mount_nodev_root().

As a solution, don't treat errors in mount_nodev_root() as errors that
require panics and allow failback to the mount flow that existed before
patch citied in Fixes tag.

Fixes: f9259be6a9e7 ("init: allow mounting arbitrary non-blockdevice filesystems as root")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
I'm not sure if this is the right thing to do, but it works for me.
---
 init/do_mounts.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 2ed30ff6c906..b423ea7dcc6b 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -553,9 +553,6 @@ static int __init mount_nodev_root(void)
 				    root_mount_data);
 		if (!err)
 			break;
-		if (err != -EACCES && err != -EINVAL)
-			panic("VFS: Unable to mount root \"%s\" (%s), err=%d\n",
-			      root_device_name, fstype, err);
 	}
 
 	free_page((unsigned long)fs_names);
-- 
2.31.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -rc] init: don't panic if mount_nodev_root failed
  2021-09-14  9:12 [PATCH -rc] init: don't panic if mount_nodev_root failed Leon Romanovsky
@ 2021-09-14 15:07 ` Christoph Hellwig
  2021-09-19  5:46 ` Leon Romanovsky
  1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2021-09-14 15:07 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Al Viro, Christoph Hellwig, Leon Romanovsky, linux-kernel,
	Jason Gunthorpe

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -rc] init: don't panic if mount_nodev_root failed
  2021-09-14  9:12 [PATCH -rc] init: don't panic if mount_nodev_root failed Leon Romanovsky
  2021-09-14 15:07 ` Christoph Hellwig
@ 2021-09-19  5:46 ` Leon Romanovsky
  2021-09-19  6:08   ` Al Viro
  1 sibling, 1 reply; 5+ messages in thread
From: Leon Romanovsky @ 2021-09-19  5:46 UTC (permalink / raw)
  To: Al Viro, Christoph Hellwig; +Cc: linux-kernel, Jason Gunthorpe, Linus Torvalds

On Tue, Sep 14, 2021 at 12:12:10PM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
> 
> Attempt to mount 9p file system as root gives the following kernel panic:
> 
>  9pnet_virtio: no channels available for device root
>  Kernel panic - not syncing: VFS: Unable to mount root "root" (9p), err=-2
>  CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc1+ #127
>  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
>  Call Trace:
>   dump_stack_lvl+0x45/0x59
>   panic+0x1e2/0x44b
>   ? __warn_printk+0xf3/0xf3
>   ? free_unref_page+0x2d4/0x4a0
>   ? trace_hardirqs_on+0x32/0x120
>   ? free_unref_page+0x2d4/0x4a0
>   mount_root+0x189/0x1e0
>   prepare_namespace+0x136/0x165
>   kernel_init_freeable+0x3b8/0x3cb
>   ? rest_init+0x2e0/0x2e0
>   kernel_init+0x19/0x130
>   ret_from_fork+0x1f/0x30
>  Kernel Offset: disabled
>  ---[ end Kernel panic - not syncing: VFS: Unable to mount root "root" (9p), err=-2 ]---
> 
> QEMU command line:
>  "qemu-system-x86_64 -append root=/dev/root rw rootfstype=9p rootflags=trans=virtio ..."
> 
> This error is because root_device_name is truncated in prepare_namespace() from
> being "/dev/root" to be "root" prior to call to mount_nodev_root().
> 
> As a solution, don't treat errors in mount_nodev_root() as errors that
> require panics and allow failback to the mount flow that existed before
> patch citied in Fixes tag.
> 
> Fixes: f9259be6a9e7 ("init: allow mounting arbitrary non-blockdevice filesystems as root")
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
> I'm not sure if this is the right thing to do, but it works for me.
> ---
>  init/do_mounts.c | 3 ---
>  1 file changed, 3 deletions(-)

Hi,

I assume that after Christoph gave his ROB [1], the patch is ok.
Should I do anything else in order to progress with merging it?

Thanks

[1] https://lore.kernel.org/all/20210914150709.GA32708@lst.de/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -rc] init: don't panic if mount_nodev_root failed
  2021-09-19  5:46 ` Leon Romanovsky
@ 2021-09-19  6:08   ` Al Viro
  2021-09-19  6:38     ` Leon Romanovsky
  0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2021-09-19  6:08 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Christoph Hellwig, linux-kernel, Jason Gunthorpe, Linus Torvalds

On Sun, Sep 19, 2021 at 08:46:39AM +0300, Leon Romanovsky wrote:
> On Tue, Sep 14, 2021 at 12:12:10PM +0300, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@nvidia.com>
> > 
> > Attempt to mount 9p file system as root gives the following kernel panic:
> > 
> >  9pnet_virtio: no channels available for device root
> >  Kernel panic - not syncing: VFS: Unable to mount root "root" (9p), err=-2
> >  CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc1+ #127
> >  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
> >  Call Trace:
> >   dump_stack_lvl+0x45/0x59
> >   panic+0x1e2/0x44b
> >   ? __warn_printk+0xf3/0xf3
> >   ? free_unref_page+0x2d4/0x4a0
> >   ? trace_hardirqs_on+0x32/0x120
> >   ? free_unref_page+0x2d4/0x4a0
> >   mount_root+0x189/0x1e0
> >   prepare_namespace+0x136/0x165
> >   kernel_init_freeable+0x3b8/0x3cb
> >   ? rest_init+0x2e0/0x2e0
> >   kernel_init+0x19/0x130
> >   ret_from_fork+0x1f/0x30
> >  Kernel Offset: disabled
> >  ---[ end Kernel panic - not syncing: VFS: Unable to mount root "root" (9p), err=-2 ]---
> > 
> > QEMU command line:
> >  "qemu-system-x86_64 -append root=/dev/root rw rootfstype=9p rootflags=trans=virtio ..."
> > 
> > This error is because root_device_name is truncated in prepare_namespace() from
> > being "/dev/root" to be "root" prior to call to mount_nodev_root().
> > 
> > As a solution, don't treat errors in mount_nodev_root() as errors that
> > require panics and allow failback to the mount flow that existed before
> > patch citied in Fixes tag.
> > 
> > Fixes: f9259be6a9e7 ("init: allow mounting arbitrary non-blockdevice filesystems as root")
> > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > ---
> > I'm not sure if this is the right thing to do, but it works for me.
> > ---
> >  init/do_mounts.c | 3 ---
> >  1 file changed, 3 deletions(-)
> 
> Hi,
> 
> I assume that after Christoph gave his ROB [1], the patch is ok.
> Should I do anything else in order to progress with merging it?

Sits in the local pile; will go to Linus tomorrow...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -rc] init: don't panic if mount_nodev_root failed
  2021-09-19  6:08   ` Al Viro
@ 2021-09-19  6:38     ` Leon Romanovsky
  0 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2021-09-19  6:38 UTC (permalink / raw)
  To: Al Viro; +Cc: Christoph Hellwig, linux-kernel, Jason Gunthorpe, Linus Torvalds

On Sun, Sep 19, 2021 at 06:08:44AM +0000, Al Viro wrote:
> On Sun, Sep 19, 2021 at 08:46:39AM +0300, Leon Romanovsky wrote:
> > On Tue, Sep 14, 2021 at 12:12:10PM +0300, Leon Romanovsky wrote:
> > > From: Leon Romanovsky <leonro@nvidia.com>
> > > 
> > > Attempt to mount 9p file system as root gives the following kernel panic:
> > > 
> > >  9pnet_virtio: no channels available for device root
> > >  Kernel panic - not syncing: VFS: Unable to mount root "root" (9p), err=-2
> > >  CPU: 2 PID: 1 Comm: swapper/0 Not tainted 5.15.0-rc1+ #127
> > >  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
> > >  Call Trace:
> > >   dump_stack_lvl+0x45/0x59
> > >   panic+0x1e2/0x44b
> > >   ? __warn_printk+0xf3/0xf3
> > >   ? free_unref_page+0x2d4/0x4a0
> > >   ? trace_hardirqs_on+0x32/0x120
> > >   ? free_unref_page+0x2d4/0x4a0
> > >   mount_root+0x189/0x1e0
> > >   prepare_namespace+0x136/0x165
> > >   kernel_init_freeable+0x3b8/0x3cb
> > >   ? rest_init+0x2e0/0x2e0
> > >   kernel_init+0x19/0x130
> > >   ret_from_fork+0x1f/0x30
> > >  Kernel Offset: disabled
> > >  ---[ end Kernel panic - not syncing: VFS: Unable to mount root "root" (9p), err=-2 ]---
> > > 
> > > QEMU command line:
> > >  "qemu-system-x86_64 -append root=/dev/root rw rootfstype=9p rootflags=trans=virtio ..."
> > > 
> > > This error is because root_device_name is truncated in prepare_namespace() from
> > > being "/dev/root" to be "root" prior to call to mount_nodev_root().
> > > 
> > > As a solution, don't treat errors in mount_nodev_root() as errors that
> > > require panics and allow failback to the mount flow that existed before
> > > patch citied in Fixes tag.
> > > 
> > > Fixes: f9259be6a9e7 ("init: allow mounting arbitrary non-blockdevice filesystems as root")
> > > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > > ---
> > > I'm not sure if this is the right thing to do, but it works for me.
> > > ---
> > >  init/do_mounts.c | 3 ---
> > >  1 file changed, 3 deletions(-)
> > 
> > Hi,
> > 
> > I assume that after Christoph gave his ROB [1], the patch is ok.
> > Should I do anything else in order to progress with merging it?
> 
> Sits in the local pile; will go to Linus tomorrow...

Thanks Al,

I have a question for the next time, is it possible to see the status
of the patches without nagging you?

Thanks

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-19  6:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14  9:12 [PATCH -rc] init: don't panic if mount_nodev_root failed Leon Romanovsky
2021-09-14 15:07 ` Christoph Hellwig
2021-09-19  5:46 ` Leon Romanovsky
2021-09-19  6:08   ` Al Viro
2021-09-19  6:38     ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).