Bug 2065481

Summary: [virtio-win][virtio-fs] FUSE_RELEASEDIR is submitted with invalid file handle
Product: Red Hat Enterprise Linux 9 Reporter: Viktor Prutyanov <vprutyan>
Component: virtio-winAssignee: Viktor Prutyanov <vprutyan>
virtio-win sub component: virtio-win-prewhql QA Contact: xiagao
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: coli, jinzhao, juzhang, qizhu, yvugenfi
Version: 9.0   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 10:45:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Viktor Prutyanov 2022-03-17 23:39:05 UTC
Description of problem:

During CreateDirectory handling (WinAPI call) WinFSP submits 'Create' and then 'Close' operations to the service. On 'Close' the service submits FUSE_RELEASEDIR message to the host with invalid file handle (-1) because directory has never opened (FUSE_MKDIR only creates directory).

How reproducible: 100%

Steps to Reproduce:
1. Create new directory with WinAPI's CreateDirectory
2. Check virtiofsd-rs output

Actual results:

// InHeader { len: 57, opcode: 9 (FUSE_MKDIR), unique: 889, nodeid: 1, uid: 1000, gid: 1000, pid: 8, padding: 0 }
Replying OK, header: OutHeader { len: 144, error: 0, unique: 889 }
// InHeader { len: 64, opcode: 29 (FUSE_RELEASEDIR), unique: 890, nodeid: 16, uid: 0, gid: 0, pid: 8, padding: 527 }
Replying ERROR, header: OutHeader { len: 16, error: -9, unique: 890 }

Expected results:

CreateDirectory should not cause virtiofsd-rs ERROR reply.

Comment 2 xiagao 2022-03-21 08:21:20 UTC
Hi Viktor,
Could you tell me the virtiofsd version and virtiofs driver version, I want to reproduce it.

Thanks,
Xiaoling

Comment 3 Viktor Prutyanov 2022-03-22 15:13:32 UTC
Hi Xiaoling,

virtio-win - 0.1.215
virtiofsd - 1.1.0

Comment 4 xiagao 2022-03-28 07:46:04 UTC
Test with following pkg
virtio-win-217
virtiofsd-1.1.0-4.el9_0.x86_64
qemu-kvm-6.2.0-12.el9.x86_64

Reproduce stepts:
1. # /usr/libexec/virtiofsd --socket-path=/tmp/sock1 -o source=/home/test -d
2. boot up win2019
3. start virtiofs.ext
4. create folder with CreateDirectoryA()
C:\>python2.7 -c "import ctypes; dll=ctypes.windll.kernel32;dll.CreateDirectoryA('Z:\\xxxxxxx.txt', 0)"


Results:
[2022-03-28T07:39:37Z DEBUG virtiofsd] HIPRIO_QUEUE_EVENT
[2022-03-28T07:39:37Z DEBUG virtiofsd::server] Received request: 1
[2022-03-28T07:39:37Z DEBUG virtiofsd::server] Replying OK, header: OutHeader { len: 144, error: 0, unique: 445 }
[2022-03-28T07:39:37Z DEBUG virtiofsd] HIPRIO_QUEUE_EVENT
[2022-03-28T07:39:37Z DEBUG virtiofsd::server] Received request: 9
[2022-03-28T07:39:37Z DEBUG virtiofsd::server] Replying OK, header: OutHeader { len: 144, error: 0, unique: 446 }
[2022-03-28T07:39:37Z DEBUG virtiofsd] HIPRIO_QUEUE_EVENT
[2022-03-28T07:39:37Z DEBUG virtiofsd::server] Received request: 29
[2022-03-28T07:39:37Z DEBUG virtiofsd::server] Replying ERROR, header: OutHeader { len: 16, error: -9, unique: 447 }
[2022-03-28T07:39:38Z DEBUG virtiofsd] HIPRIO_QUEUE_EVENT
[2022-03-28T07:39:38Z DEBUG virtiofsd::server] Received request: 1
[2022-03-28T07:39:38Z DEBUG virtiofsd::server] Replying OK, header: OutHeader { len: 144, error: 0, unique: 448 }


Hi Viktor,
I'm not sure if I reproduced the problem,could you have a check?

Thanks,
Xiaoling

Comment 5 Viktor Prutyanov 2022-03-28 13:48:34 UTC
Hi Xiaoling,

This is the problem (error: -9):

[2022-03-28T07:39:37Z DEBUG virtiofsd::server] Received request: 29
[2022-03-28T07:39:37Z DEBUG virtiofsd::server] Replying ERROR, header: OutHeader { len: 16, error: -9, unique: 447 }

Comment 6 xiagao 2022-04-26 09:40:17 UTC
Test win2019 with virtio-win-prewhql-0.1-218 version, the results are good.
No error: -9 in debug log. Verify it.

Comment 9 errata-xmlrpc 2022-11-15 10:45:57 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 (virtio-win bug fix and enhancement update), 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:8261