RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2057882 - improve error message when virtiofsd refuses '-o flock'
Summary: improve error message when virtiofsd refuses '-o flock'
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.0
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: rc
: ---
Assignee: Ján Tomko
QA Contact: Lili Zhu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-24 07:13 UTC by yalzhang@redhat.com
Modified: 2022-05-27 17:42 UTC (History)
14 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of: 2055537
Environment:
Last Closed: 2022-05-27 17:42:33 UTC
Type: Feature Request
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-113441 0 None None None 2022-02-24 07:23:08 UTC

Description yalzhang@redhat.com 2022-02-24 07:13:57 UTC
+++ This bug was initially created as a clone of Bug #2055537 +++

Description of problem:
VM with virtio filesystem can not start successfully with virtiofsd

Version-Release number of selected component (if applicable):
virtiofsd-1.1.0-1.el9.x86_64
libvirt-8.0.0-4.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. On a rhel 9 host, install libvirt and qemu-kvm package, virtiofsd will be installed as dependency(this is expected, refer to bug 2055284#c3);

2. Start a vm with filesystem setting, it will fail:
# mkdir /path1
# virsh dumpxml rhel9
...
<filesystem type='mount' accessmode='passthrough'>
      <driver type='virtiofs'/>
      <binary path='/usr/libexec/virtiofsd' xattr='on'>
        <cache mode='none'/>
        <lock posix='on' flock='on'/>
      </binary>
      <source dir='/path1'/>
      <target dir='mount_tag'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </filesystem>
...

# virsh start rhel9
error: Failed to start domain 'rhel9'
error: internal error: virtiofsd died unexpectedly

# cat rhel9-fs0-virtiofsd.log
error: Invalid compat argument '-o flock'

Actual results:
VM with virtio filesystem setting can not start with virtiofsd

Expected results:
virtiofsd process should drop '-o flock' or reject enabling it, and VM should start successfully

Additional info:
Refer to bug 2055284#c5, remote locks is not properly supported in virtiofsd. Suggest to drop the option when start virtiofsd process. This is a regression because we use qemu-virtiofsd before, and the virtiofsd can start successfully, so dose the vm.

Comment 1 Peter Krempa 2022-02-24 08:26:49 UTC
Well, the only thing that libvirt can do is improve the error message potentially. Otherwise libvirt can't ignore user provided configuration.

Comment 2 yalzhang@redhat.com 2022-02-24 08:49:23 UTC
(In reply to Peter Krempa from comment #1)
> Well, the only thing that libvirt can do is improve the error message
> potentially. Otherwise libvirt can't ignore user provided configuration.

Hi Peter, Is libvirt launch the virtiofsd process? If that's the truth, can libvirt drop the '-o flock', then the process can start successfully? then the VM can start successfully as before?

Comment 3 yalzhang@redhat.com 2022-02-24 09:21:35 UTC
Sorry, I finally realized that "<lock posix='on' flock='on'/>" is set by myself in the xml. If we use "<lock posix='off' flock='off'/>" or ignore this setting, vm can start successfully.

 <filesystem type='mount' accessmode='passthrough'>
      <driver type='virtiofs'/>
      <binary path='/usr/libexec/virtiofsd' xattr='on'>
        <cache mode='none'/>
        <lock posix='off' flock='off'/>
      </binary>
...
# virsh start avocado-vt-vm1
Domain 'avocado-vt-vm1' started

# ps aux | grep virtiofsd
root     1759570  0.0  0.0   5676  1436 ?        S    04:18   0:00 /usr/libexec/virtiofsd --fd=24 -o source=/path1,cache=none,xattr,no_flock,no_posix_lock
root     1759572  0.0  0.0 140876  2492 ?        Sl   04:18   0:00 /usr/libexec/virtiofsd --fd=24 -o source=/path1,cache=none,xattr,no_flock,no_posix_lock

when ignore with:
<binary path='/usr/libexec/virtiofsd' xattr='on'>
        <cache mode='none'/>
      </binary>
guest start successfully with:
# ps aux  | grep virtiofsd | grep -v grep
root     1759789  0.0  0.0   5676  1436 ?        S    04:20   0:00 /usr/libexec/virtiofsd --fd=24 -o source=/path1,cache=none,xattr
root     1759792  0.0  0.0 140876  2392 ?        Sl   04:20   0:00 /usr/libexec/virtiofsd --fd=24 -o source=/path1,cache=none,xattr

Comment 4 Vivek Goyal 2022-03-16 11:49:24 UTC
I think we might need a fix in virtiofsd.

error: Invalid compat argument '-o flock'

Looks like this compatibility argument might not be implemented in rust-virtiofsd. I think that's the first problem we need to fix. Daemon should not die.

We do not support blocking flock/posix_locks. And that's why these are disabled by default.

If user does choose to enable "-flock" and then calls a blocking operation, then daemon returns -EOPNOTSUPP.

So definitely daemon should not die.

Thinking more about it. We probably should not support remote "flock" or "posix_lock" at all and fail early. Just supporting half the functionality is not very useful. Applications will start failing later. So may be we should fail early saying posix_lock/flock are not supported.

Comment 5 Vivek Goyal 2022-03-16 12:47:02 UTC
I just tested with upstream rust virtiofsd and it accepts "-o flock" and continues to run and does not crash. If we completely block it upstream, then people will complain about regression. So may be don't do anything as it is off by default.

Comment 6 German Maglione 2022-03-16 13:08:23 UTC
(In reply to Vivek Goyal from comment #5)
> I just tested with upstream rust virtiofsd and it accepts "-o flock" and
> continues to run and does not crash. If we completely block it upstream,
> then people will complain about regression. So may be don't do anything as
> it is off by default.

That is strange, I don't see the same behavior, the upstream Rust virtiofsd only accepts '-o no_flock' and '-o no_posix_lock'.

Comment 7 Vivek Goyal 2022-03-16 13:13:47 UTC
What do you see when you specify "-o flock". For me it did not complain.

Starting program: /root/vgoyal/git/rhvgoyal-qemu/build/tools/virtiofsd/virtiofsd --socket-path=/tmp/vhostqemu -o source=/mnt/intel-ssd-p1/virtiofs-source/ -o cache=auto -o xattr -o no_allow_direct_io -d -o sandbox=chroot -o no_killpriv_v2 -o xattrmap=:prefix:all:security.selinux:trusted.virtiofsd.::bad:client:trusted.virtiofsd.:::bad:server::security.selinux::ok:all::: -o modcaps=+sys_admin -o security_label -o flock --rlimit-nofile=1048576

Comment 8 Vivek Goyal 2022-03-16 13:16:52 UTC
My bad. In my scripts I was using C virtiofsd. I will switch to rust virtiofsd and test again.

Comment 9 Vivek Goyal 2022-03-16 13:20:43 UTC
Ok, finally I have rust version running and I see.

"error: Invalid compat argument '-o flock'"

And if I pass "--flock". I see.

error: Found argument 'flock' which wasn't expected, or isn't valid in this context

USAGE:
    virtiofsd -d -o <compat-options>... --fd <fd> --socket <socket> --socket-path <socket-path>

So current behavior is along the expected lines that we don't support flock yet.

There is a chance that some people might complain that it is not a complete drop in replacement of C version. I guess we can push back saying without blocking lock support, its not very useful anyway. Lets see how does it go.

Comment 10 Klaus Heinrich Kiwi 2022-05-25 21:39:46 UTC
(In reply to Vivek Goyal from comment #9)

> 
> There is a chance that some people might complain that it is not a complete
> drop in replacement of C version. I guess we can push back saying without
> blocking lock support, its not very useful anyway. Lets see how does it go.

Vivek, given the above, should we WILLNOTFIX this bug? Or at lease lower the priority significantly?

Comment 11 Vivek Goyal 2022-05-26 17:54:16 UTC
Let us make sure libvirt is not enabling posix_lock and flock on by default.

<lock posix='on' flock='on'/>

If libvirt enables it by default, I think that should be fixed. Rust version does not support it at all. And C version only support non-blocking posix locks.

If this is not a default in libvirt, we can close this bug saying WILLNOTFIX.

Comment 12 Klaus Heinrich Kiwi 2022-05-26 19:47:55 UTC
(In reply to Vivek Goyal from comment #11)
> Let us make sure libvirt is not enabling posix_lock and flock on by default.
> 
> <lock posix='on' flock='on'/>
> 
> If libvirt enables it by default, I think that should be fixed. Rust version
> does not support it at all. And C version only support non-blocking posix
> locks.
> 
> If this is not a default in libvirt, we can close this bug saying WILLNOTFIX.

Bouncing this needingo back to Jan...

Comment 13 Ján Tomko 2022-05-27 11:30:15 UTC
Libvirt does not add any posix_lock or flock options by default.
Only when the user specifies it in the XML.

Comment 14 Vivek Goyal 2022-05-27 13:27:08 UTC
Good to hear that libvirt does not enable (or recommend) to enable remote posix/flock by default.

I am looking at the original bug description again.

Expected results:
virtiofsd process should drop '-o flock' or reject enabling it, and VM should start successfully.

I think this is not a fair expectation given how code is structured. If user passes an option to virtiofsd which is not supported, dameon fails. It does not fallback to not enabling it automatically.

I think only exception at this point of time is option --inode-file-handles which allows one to specify never/prefer/mandatory. And in case of prefer we will fallback to not enabling it.

We want to add these "prefer" kind of options very carefully and add it if it really makes lot of sense. In case of enabling remote posix/flock, I can't see how it makes sense.

Bottom line, I think we will not fix this. If user passes "-o flock" or "-o posix_lock", virtiofsd will exit with an error (rust version) as it does not support these options.

Comment 15 Klaus Heinrich Kiwi 2022-05-27 17:42:33 UTC
(In reply to Vivek Goyal from comment #14)
> Good to hear that libvirt does not enable (or recommend) to enable remote
> posix/flock by default.
> 
> I am looking at the original bug description again.
> 
> Expected results:
> virtiofsd process should drop '-o flock' or reject enabling it, and VM
> should start successfully.
> 
> I think this is not a fair expectation given how code is structured. If user
> passes an option to virtiofsd which is not supported, dameon fails. It does
> not fallback to not enabling it automatically.
> 
> I think only exception at this point of time is option --inode-file-handles
> which allows one to specify never/prefer/mandatory. And in case of prefer we
> will fallback to not enabling it.
> 
> We want to add these "prefer" kind of options very carefully and add it if
> it really makes lot of sense. In case of enabling remote posix/flock, I
> can't see how it makes sense.
> 
> Bottom line, I think we will not fix this. If user passes "-o flock" or "-o
> posix_lock", virtiofsd will exit with an error (rust version) as it does not
> support these options.

I'll go even further and say this is not a bug, as we at the XML level we probably shouldn't be trying to prevent the user from having complete control (and eventually shooting themselves in the foot).


Note You need to log in before you can comment on or make changes to this bug.