Description of problem: This bug comes from an upstream issue and can be reproduced downstream. https://gitlab.com/virtio-fs/virtiofsd/-/issues/67 ''' When using python and writing to a mmap file, I am seeing with cache mode auto and always that the file is increasing in size each time I write to it. ''' Version-Release number of selected component (if applicable): qemu-kvm-7.1.0-3.el9.x86_64 virtiofsd-1.4.0-1.el9.x86_64 kernel-5.14.0-178.el9.x86_64 How reproducible: 100% Steps to Reproduce: 1. start virtiofsd # /usr/libexec/virtiofsd -o source=/home/test --socket-path=/tmp/sock1 --cache auto 2. boot up a rhel920 guest 3. in guest, mount virtiofs # mount -t virtiofs myfs /mnt/test 4. write to the same space of a file with mmap ``` [root@vm-74-75 test]# cat mmap_test.py import mmap import struct l = 1024 f = open("./test.db", "a+b") f.truncate(l) m = mmap.mmap(f.fileno(), 1024, access=mmap.ACCESS_WRITE) m[0:4] = b"0000" m.flush() print(m.size()) m[0:4] = b"0000" m.flush() print(m.size()) ``` Actual results: # python3 mmap_test.py 2048 4096 Expected results: The file size will not be changed. Additional info:
Test passed with the fixed virtiofsd version, file size is NOT increasing when writing to the same address with mmap() on virtiofs backed paths, so verify the bug. [root@bootp-73-75-32 mm]# python3 mmap_test.py 1024 1024 1024 1024 pkg: virtiofsd-1.5.0-1.el9.x86_64 qemu-kvm-7.2.0-1.el9 5.14.0-219.el9.x86_64(host) 5.14.0-226.el9.x86_64(guest)
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 (virtiofsd 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-2023:2334