Bug 1996500

Summary: [virtiofs]Failed to delete vhost-user-fs-device when the shared directory is mounted in windows guest[rhel9]
Product: Red Hat Enterprise Linux 9 Reporter: xiagao
Component: virtio-winAssignee: Viktor Prutyanov <vprutyan>
virtio-win sub component: virtio-win-prewhql QA Contact: xiagao
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: kkiwi, lijin, virt-maint, yvugenfi
Version: 9.0Keywords: Triaged
Target Milestone: beta   
Target Release: ---   
Hardware: x86_64   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1996342 Environment:
Last Closed: 2022-05-17 15:35:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1996342    
Bug Blocks:    

Description xiagao 2021-08-23 02:56:06 UTC
Also hit this issue on RHEL9
qemu-kvm-6.0.0-11.el9.x86_64
qemu-virtiofsd-6.0.0-11.el9.x86_64
kernel-5.14.0-0.rc4.35.el9.x86_64
virtio-win-prewhql-0.1-207



+++ This bug was initially created as a clone of Bug #1996342 +++

Description of problem:
as $summary

Version-Release number of selected component (if applicable):
qemu-kvm-docs-6.0.0-27.module+el8.5.0+12121+c40c8708.x86_64
kernel-4.18.0-329.el8.x86_64
seabios-bin-1.14.0-1.module+el8.4.0+8855+a9e237a9.noarch
virtio-win-prewhql-0.1-207

How reproducible:
100%

Steps to Reproduce:
1. start virtiofsd daemon on host
# /usr/libexec/virtiofsd --socket-path=/tmp/socket1 -o source=/home/test

2. Boot up win2019 guest without vhost-user-fs-pci device 
    
    -device pcie-root-port,id=pcie_extra_root_port_0,multifunction=on,bus=pcie.0,addr=0x3,chassis=5 \
    -chardev socket,id=char_virtiofs_fs,path=/tmp/socket1 \

2. hotplug virtiofs device.
{"execute":"device_add","arguments":{"driver":"vhost-user-fs-pci","id":"fs-pci1","bus":"pcie_extra_root_port_0","tag":"myfs","queue-size":"1024","chardev":"char_virtiofs_fs"}}
{"return": {}}

3. hot unplug virtiofs device.
 {"execute":"device_del","arguments":{"id":"fs-pci1"}}
{"return": {}}
{"timestamp": {"seconds": 1629604708, "microseconds": 786991}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/fs-pci1/virtio-backend"}}
{"timestamp": {"seconds": 1629604708, "microseconds": 838764}, "event": "DEVICE_DELETED", "data": {"device": "fs-pci1", "path": "/machine/peripheral/fs-pci1"}}


4. repeat step 2.
{"execute":"device_add","arguments":{"driver":"vhost-user-fs-pci","id":"fs-pci1","bus":"pcie_extra_root_port_0","tag":"myfs","queue-size":"1024","chardev":"char_virtiofs_fs"}}
{"return": {}}

5. in windows guest, mount the shared directory.
1) make sure virtiofs driver is installed
2) install WINFSP in guest.(download winfsp installe: http://www.secfs.net/winfsp/rel/ )
3) start viritofs.exe(it's in virtio-win iso)
C:\> virtiofs.exe -d -1 -D -


6. repeat step 3
 {"execute":"device_del","arguments":{"id":"fs-pci1"}}
{"return": {}}



Actual results:
after step3, vhost-user-fs-device is deleted.
after step4, vhost-user-fs-device is added.
after step5, can get the shared dirctory in guest.
after step6, hotunplug failed.
Didn't get device is deleted info,such as.
{"timestamp": {"seconds": 1629604708, "microseconds": 786991}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/fs-pci1/virtio-backend"}}
{"timestamp": {"seconds": 1629604708, "microseconds": 838764}, "event": "DEVICE_DELETED", "data": {"device": "fs-pci1", "path": "/machine/peripheral/fs-pci1"}}
The device is still in guest.


Expected results:
Can hotunplug virtiofs device.

Additional info:
1) rhel guest works well with the steps above.
2) cmd line:
MALLOC_PERTURB_=1  /usr/libexec/qemu-kvm \
    -name 'avocado-vt-vm1'  \
    -sandbox on  \
    -machine q35 \
    -device pcie-root-port,id=pcie-root-port-0,multifunction=on,bus=pcie.0,addr=0x1,chassis=1 \
    -device pcie-pci-bridge,id=pcie-pci-bridge-0,addr=0x0,bus=pcie-root-port-0  \
    -nodefaults \
    -device VGA,bus=pcie.0,addr=0x2 \
    -m 4096 \
    -object memory-backend-file,size=4G,mem-path=/dev/shm,share=yes,id=mem-mem1  \
    -smp 24,maxcpus=24,cores=12,threads=1,dies=1,sockets=2  \
    -numa node,memdev=mem-mem1,nodeid=0  \
    -cpu 'Skylake-Server',hv_stimer,hv_synic,hv_vpindex,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time,hv_frequencies,hv_runtime,hv_tlbflush,hv_reenlightenment,hv_stimer_direct,hv_ipi,+kvm_pv_unhalt \
    -device pvpanic,ioport=0x505,id=idwOGXyj \
    -device pcie-root-port,id=pcie-root-port-1,port=0x1,addr=0x1.0x1,bus=pcie.0,chassis=2 \
    -device qemu-xhci,id=usb1,bus=pcie-root-port-1,addr=0x0 \
    -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
    -device pcie-root-port,id=pcie-root-port-2,port=0x2,addr=0x1.0x2,bus=pcie.0,chassis=3 \
    -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pcie-root-port-2,addr=0x0 \
    -blockdev node-name=file_image1,driver=file,auto-read-only=on,discard=unmap,aio=threads,filename=$1,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_image1,driver=qcow2,read-only=off,cache.direct=on,cache.no-flush=off,file=file_image1 \
    -device scsi-hd,id=image1,drive=drive_image1,write-cache=on \
    -device pcie-root-port,id=pcie-root-port-3,port=0x3,addr=0x1.0x3,bus=pcie.0,chassis=4 \
    -device virtio-net-pci,mac=9a:80:46:fc:c0:44,id=idIrkxeJ,netdev=idc5mMT9,bus=pcie-root-port-3,addr=0x0  \
    -netdev tap,id=idc5mMT9 \
    -blockdev node-name=file_cd1,driver=file,auto-read-only=on,discard=unmap,aio=threads,filename=/home/kvm_autotest_root/iso/windows/winutils.iso,cache.direct=on,cache.no-flush=off \
    -blockdev node-name=drive_cd1,driver=raw,read-only=on,cache.direct=on,cache.no-flush=off,file=file_cd1 \
    -device ide-cd,id=cd1,drive=drive_cd1,write-cache=on,bus=ide.0,unit=0 \
    -cdrom /home/kvm_autotest_root/iso/windows/virtio-win-prewhql-0.1-203.iso \
    -vnc :1 -qmp tcp:0:6666,server,nowait \
    -rtc base=localtime,clock=host,driftfix=slew  \
    -boot menu=off,order=cdn,once=c,strict=off \
    -enable-kvm -monitor stdio \
    -device pcie-root-port,id=pcie_extra_root_port_0,multifunction=on,bus=pcie.0,addr=0x4,chassis=5 \
    -chardev socket,id=char_virtiofs_fs,path=/tmp/socket1 \
3) pc machine type also has this issue.

Comment 1 xiagao 2021-12-06 11:11:36 UTC
Test with virtio-win-prewhql-215, hotplug and unplug works well.

steps is like comment 0.
After step6, vhost-user-fs-pci was successfully deleted.

{"execute":"device_add","arguments":{"driver":"vhost-user-fs-pci","id":"fs-pci1","bus":"pci.11","tag":"myfs","queue-size":"1024","chardev":"char0"}}
{"return": {}}
 {"execute":"device_del","arguments":{"id":"fs-pci1"}}
{"return": {}}
{"timestamp": {"seconds": 1638783026, "microseconds": 816090}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/fs-pci1/virtio-backend"}}
{"timestamp": {"seconds": 1638783026, "microseconds": 816262}, "event": "DEVICE_DELETED", "data": {"device": "fs-pci1", "path": "/machine/peripheral/fs-pci1"}}

So change bz status to verified.

Comment 2 xiagao 2021-12-13 07:33:45 UTC
Test on RHEL9.0.0 host, hit this issue with virtio-win-predhql-0.1-214 version, but pass with  virtio-win-predhql-0.1-215 version.
So this issue was related with viofs driver for windows guest.
I will change the component.

Comment 3 xiagao 2021-12-15 04:05:45 UTC
*** Bug 1996342 has been marked as a duplicate of this bug. ***

Comment 6 errata-xmlrpc 2022-05-17 15:35:26 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: virtio-win), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:3890