Re: [Virtio-fs] [PATCH] init/do_mounts.c: Add root="fstag:<tag>" syntax for root device

From: Harry G. Coin
Date: Tue Jun 08 2021 - 14:44:03 EST


On 6/8/21 10:35 AM, 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) ]

Whatever the best direction forward might be for kernel patches
regarding 'not block device as root', it would ease learning curves if
'the patterns that set config issue X' were the same across root 'not
block device options' whether cephfs, nfs, 9p, virtiofs.  All of them
will have to handle the selinux xattr/issue, posix and flock issues,
caching etc.  While by definition virtiofs has to exist only in a vm
guest, the others could be baremetal or vm guest roots.  (How much 9p's
other-than-guest transports are used I don't know).

FYI (though patching the kernel may be the best option)  there is a case
that does not have those kernel panics for virtiofs-root and 9p root
using stock fc34.  As 9p, the virtiofs method uses the initrd creation
mechanisms provided by 'dracut' or 'initramfs' to provide the 'sysroot
pivot glue'.

On the fc34 guest a successful 'direct kernel boot' today looks like:

kernel path: /vmsystems/fedora_generic/boot/vmlinuz

initrd path: /vmsystems/fedora_generic/boot/initrd.img

Kernel args: root=virtiofs:myfs rd.shell rd.fstab


The xml to pass through virtio-fs is:

<filesystem type="mount" accessmode="passthrough">
  <driver type="virtiofs" queue="1024"/>
  <binary xattr="on">
    <lock posix="on" flock="on"/>
  </binary>
  <source dir="/vmsystems/fedora_generic"/>
  <target dir="myfs"/>
</filesystem>

The guest fstab is:

myfs / virtiofs defaults 0 0

HTH

Harry Coin