All of lore.kernel.org
 help / color / mirror / Atom feed
* [Virtio-fs] [RFC][PATCH] init: Allow mounting virtio_fs instance as rootfs
@ 2019-07-25 20:49 Vivek Goyal
  2019-07-29 10:15 ` Stefan Hajnoczi
  0 siblings, 1 reply; 3+ messages in thread
From: Vivek Goyal @ 2019-07-25 20:49 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: virtio-fs-list

Hi Stefan,

I think following patch might allow you to mount virtio_fs as rootfs
with new syntax.

I have only compiled it and not tested it. Plase have a look.

Thanks
Vivek

virtio_fs passes root=<fs-instance-name> as identifier of virtio_fs instance
to be mounted. None of the existing primitives seems to fit virito_fs needs.

So check rootfstype and if it is "virtio_fs", do not parse root= further
and call mount_block_root().

This is similar to carving out special paths for ubifs. Now virtio_fs
users should be able to pass "root=myfs rootfstype=virtio_fs" and be
able to mount that particular instance of virtio_fs as rootfs.
 
Yet-To-Be-Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
 init/do_mounts.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: rhvgoyal-linux-fuse/init/do_mounts.c
===================================================================
--- rhvgoyal-linux-fuse.orig/init/do_mounts.c	2019-04-09 15:42:17.096602971 -0400
+++ rhvgoyal-linux-fuse/init/do_mounts.c	2019-07-25 16:40:29.226348627 -0400
@@ -595,6 +595,10 @@ void __init prepare_namespace(void)
 			mount_block_root(root_device_name, root_mountflags);
 			goto out;
 		}
+		if (root_fs_names && !strncmp(root_fs_names, "virtio_fs", 3)) {
+			mount_block_root(root_device_name, root_mountflags);
+			goto out;
+		}
 		ROOT_DEV = name_to_dev_t(root_device_name);
 		if (strncmp(root_device_name, "/dev/", 5) == 0)
 			root_device_name += 5;


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

* Re: [Virtio-fs] [RFC][PATCH] init: Allow mounting virtio_fs instance as rootfs
  2019-07-25 20:49 [Virtio-fs] [RFC][PATCH] init: Allow mounting virtio_fs instance as rootfs Vivek Goyal
@ 2019-07-29 10:15 ` Stefan Hajnoczi
  2019-07-29 12:51   ` Vivek Goyal
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Hajnoczi @ 2019-07-29 10:15 UTC (permalink / raw)
  To: Vivek Goyal; +Cc: virtio-fs-list

[-- Attachment #1: Type: text/plain, Size: 1763 bytes --]

On Thu, Jul 25, 2019 at 04:49:34PM -0400, Vivek Goyal wrote:
> Hi Stefan,
> 
> I think following patch might allow you to mount virtio_fs as rootfs
> with new syntax.

Thanks, I've sent a similar patch too.  My patch changes mount_root()
(where the nfs root code also lives) and uses do_mount_root() instead of
mount_block_root() to avoid block/partition error messages.  But I think
they are very similar in terms of functionality.

> I have only compiled it and not tested it. Plase have a look.
> 
> Thanks
> Vivek
> 
> virtio_fs passes root=<fs-instance-name> as identifier of virtio_fs instance
> to be mounted. None of the existing primitives seems to fit virito_fs needs.
> 
> So check rootfstype and if it is "virtio_fs", do not parse root= further
> and call mount_block_root().
> 
> This is similar to carving out special paths for ubifs. Now virtio_fs
> users should be able to pass "root=myfs rootfstype=virtio_fs" and be
> able to mount that particular instance of virtio_fs as rootfs.
>  
> Yet-To-Be-Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> ---
>  init/do_mounts.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> Index: rhvgoyal-linux-fuse/init/do_mounts.c
> ===================================================================
> --- rhvgoyal-linux-fuse.orig/init/do_mounts.c	2019-04-09 15:42:17.096602971 -0400
> +++ rhvgoyal-linux-fuse/init/do_mounts.c	2019-07-25 16:40:29.226348627 -0400
> @@ -595,6 +595,10 @@ void __init prepare_namespace(void)
>  			mount_block_root(root_device_name, root_mountflags);
>  			goto out;
>  		}
> +		if (root_fs_names && !strncmp(root_fs_names, "virtio_fs", 3)) {

The entire string, not just the first 3 characters:

  !strcmp(root_fs_names, "virtio_fs")

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [Virtio-fs] [RFC][PATCH] init: Allow mounting virtio_fs instance as rootfs
  2019-07-29 10:15 ` Stefan Hajnoczi
@ 2019-07-29 12:51   ` Vivek Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Vivek Goyal @ 2019-07-29 12:51 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: virtio-fs-list

On Mon, Jul 29, 2019 at 11:15:37AM +0100, Stefan Hajnoczi wrote:
> On Thu, Jul 25, 2019 at 04:49:34PM -0400, Vivek Goyal wrote:
> > Hi Stefan,
> > 
> > I think following patch might allow you to mount virtio_fs as rootfs
> > with new syntax.
> 
> Thanks, I've sent a similar patch too.  My patch changes mount_root()
> (where the nfs root code also lives) and uses do_mount_root() instead of
> mount_block_root() to avoid block/partition error messages.  But I think
> they are very similar in terms of functionality.

Ok, sounds good. I will squash that patch with one of the existing
patches.

Thanks
Vivek

> 
> > I have only compiled it and not tested it. Plase have a look.
> > 
> > Thanks
> > Vivek
> > 
> > virtio_fs passes root=<fs-instance-name> as identifier of virtio_fs instance
> > to be mounted. None of the existing primitives seems to fit virito_fs needs.
> > 
> > So check rootfstype and if it is "virtio_fs", do not parse root= further
> > and call mount_block_root().
> > 
> > This is similar to carving out special paths for ubifs. Now virtio_fs
> > users should be able to pass "root=myfs rootfstype=virtio_fs" and be
> > able to mount that particular instance of virtio_fs as rootfs.
> >  
> > Yet-To-Be-Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
> > ---
> >  init/do_mounts.c |    4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > Index: rhvgoyal-linux-fuse/init/do_mounts.c
> > ===================================================================
> > --- rhvgoyal-linux-fuse.orig/init/do_mounts.c	2019-04-09 15:42:17.096602971 -0400
> > +++ rhvgoyal-linux-fuse/init/do_mounts.c	2019-07-25 16:40:29.226348627 -0400
> > @@ -595,6 +595,10 @@ void __init prepare_namespace(void)
> >  			mount_block_root(root_device_name, root_mountflags);
> >  			goto out;
> >  		}
> > +		if (root_fs_names && !strncmp(root_fs_names, "virtio_fs", 3)) {
> 
> The entire string, not just the first 3 characters:
> 
>   !strcmp(root_fs_names, "virtio_fs")



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

end of thread, other threads:[~2019-07-29 12:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-25 20:49 [Virtio-fs] [RFC][PATCH] init: Allow mounting virtio_fs instance as rootfs Vivek Goyal
2019-07-29 10:15 ` Stefan Hajnoczi
2019-07-29 12:51   ` Vivek Goyal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.