mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Vivek Goyal <vgoyal@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, virtio-fs@redhat.com,
	linux kernel mailing list <linux-kernel@vger.kernel.org>,
	Miklos Szeredi <miklos@szeredi.hu>,
	David Howells <dhowells@redhat.com>,
	viro@zeniv.linux.org.uk,
	Richard Weinberger <richard.weinberger@gmail.com>,
	dgilbert@redhat.com, Dominique Martinet <asmadeus@codewreck.org>,
	v9fs-developer@lists.sourceforge.net
Subject: Re: [PATCH] init/do_mounts.c: Add root="fstag:<tag>" syntax for root device
Date: Wed, 9 Jun 2021 10:51:56 +0100	[thread overview]
Message-ID: <YMCPPCbjbRoPAEcL@stefanha-x1.localdomain> (raw)
In-Reply-To: <20210608153524.GB504497@redhat.com>

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

On Tue, Jun 08, 2021 at 11:35:24AM -0400, Vivek Goyal wrote:
> We want to be able to mount virtiofs as rootfs and pass appropriate
> kernel command line. Right now there does not seem to be a good way
> to do that. If I specify "root=myfs rootfstype=virtiofs", system
> panics.
> 
> virtio-fs: tag </dev/root> not found
> ..
> ..
> [ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]
> 
> Basic problem here is that kernel assumes that device identifier
> passed in "root=" is a block device. But there are few execptions
> to this rule to take care of the needs of mtd, ubi, NFS and CIFS.
> 
> For example, mtd and ubi prefix "mtd:" or "ubi:" respectively.
> 
> "root=mtd:<identifier>" or "root=ubi:<identifier>"
> 
> NFS and CIFS use "root=/dev/nfs" and CIFS passes "root=/dev/cifs" and
> actual root device details come from filesystem specific kernel
> command line options.
> 
> virtiofs does not seem to fit in any of the above categories. In fact
> we have 9pfs which can be used to boot from but it also does not
> have a proper syntax to specify rootfs and does not fit into any of
> the existing syntax. They both expect a device "tag" to be passed
> in a device to be mounted. And filesystem knows how to parse and
> use "tag".
> 
> So this patch proposes that we add a new prefix "fstag:" which specifies
> that identifier which follows is filesystem specific tag and its not
> a block device. Just pass this tag to filesystem and filesystem will
> figure out how to mount it.
> 
> For example, "root=fstag:<tag>".
> 
> In case of virtiofs, I can specify "root=fstag:myfs rootfstype=virtiofs"
> and it works.
> 
> I think this should work for 9p as well. "root=fstag:myfs rootfstype=9p".
> Though I have yet to test it.
> 
> This kind of syntax should be able to address wide variety of use cases
> where root device is not a block device and is simply some kind of
> tag/label understood by filesystem.

"fstag" is kind of virtio-9p/fs specific. The intended effect is really
to specify the file system source (like in mount(2)) without it being
interpreted as a block device.

In a previous discussion David Gilbert suggested detecting file systems
that do not need a block device:
https://patchwork.kernel.org/project/linux-fsdevel/patch/20190906100324.8492-1-stefanha@redhat.com/

I never got around to doing it, but can do_mounts.c just look at struct
file_system_type::fs_flags FS_REQUIRES_DEV to detect non-block device
file systems?

That way it would know to just mount with root= as the source instead of
treating it as a block device. No root= prefix would be required and it
would handle NFS, virtiofs, virtio-9p, etc without introducing the
concept of a "tag".

  root=myfs rootfstype=virtiofs rootflags=...

I wrote this up quickly after not thinking about the topic for 2 years,
so the idea may not work at all :).

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

  parent reply	other threads:[~2021-06-09  9:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 15:35 Vivek Goyal
2021-06-08 18:38 ` [Virtio-fs] " Harry G. Coin
2021-06-08 19:26   ` Vivek Goyal
2021-06-08 19:49     ` Harry G. Coin
2021-06-08 21:41 ` Dominique Martinet
2021-06-09  9:51 ` Stefan Hajnoczi [this message]
2021-06-09 14:13   ` [Virtio-fs] " Harry G. Coin
2021-06-09 15:45   ` Vivek Goyal
2021-06-10  8:16     ` Stefan Hajnoczi
2021-06-10  8:33       ` Dominique Martinet
2021-06-13 11:56         ` Dominique Martinet
2021-06-14 14:28           ` Vivek Goyal
2021-06-14 23:14             ` Dominique Martinet
2021-06-15 13:50               ` Vivek Goyal
2021-06-16  3:24                 ` Dominique Martinet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YMCPPCbjbRoPAEcL@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=asmadeus@codewreck.org \
    --cc=dgilbert@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=richard.weinberger@gmail.com \
    --cc=v9fs-developer@lists.sourceforge.net \
    --cc=vgoyal@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=virtio-fs@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®