[Virtio-fs] Mount error

Masayoshi Mizuma msys.mizuma at gmail.com
Sat Jul 4 18:46:25 UTC 2020


On Thu, Jul 02, 2020 at 04:20:15PM +0100, David Lomas wrote:
> I've compiled and installed kernel 5.7, and have virtiofs mostly working,
> but I'm still being caught by something which leads to an error. I've
> defined the filesystem on the host like this:
> 
> <filesystem type='mount' accessmode='passthrough'>
>   <driver type='virtiofs'/>
>   <binary path='/usr/libexec/virtiofsd'/>
>   <source dir='/data/hosts/VMHOSTNAME/users'/>
>   <target dir='users'/>
>   <address type='pci' domain='0x0000' bus='0x00' slot='0x09'
> function='0x0'/>
> </filesystem>
> 
> and on the host I've put this in /etc/fstab:
> 
> users           /appdata/users            virtiofs
> 
> On boot, the /appdata/users folder is correctly mounted, but if I ever try
> to manually unmount / remount, or if I boot up without an entry in
> /etc/fstab and try to mount manually with something like:
> 
> # mount -t virtiofs users /appdata/users
> 
> I get this rather opaque error:
> 
> mount: /appdata/users : wrong fs type, bad option, bad superblock on /
> appdata/users, missing codepage or helper program, or other error.
> 
> Are there more options I should be specifying which for some reason aren't
> needed on boot?

Hi David,

If 'users' directory is in the current directory, the mount command will fail.

  # ls
  users
  # mount -t virtiofs --source users /mnt/users
  mount: /mnt/users: wrong fs type, bad option, bad superblock on /mnt/users, missing codepage or helper program, or other error.
  #

That's because the mount command handles the full path of 'users' as the
first argument for mount() system call like as:

  # strace -emount mount -t virtiofs users /mnt/users
  mount("/mnt/users", "/mnt/users", "virtiofs", MS_MGC_VAL, NULL) = -1 EINVAL (Invalid argument)
  mount: /mnt/users: wrong fs type, bad option, bad superblock on /mnt/users, missing codepage or helper program, or other error.
  +++ exited with 32 +++
  # 

I'm not sure mount command has an option to avoid that, but probably
you can avoid the failure to change current directory.

Thanks,
Masa




More information about the Virtio-fs mailing list