arighi / virtme-ng

Quickly build and run kernels inside a virtualized snapshot of your live system
GNU General Public License v2.0
440 stars 47 forks source link

Stale file handle in the guest after changing file on the host #187

Open Romeus opened 5 hours ago

Romeus commented 5 hours ago

Prerequisites

Vng is built from source and installed in a virtual environment:

(virtme) hedin@laptop:~/prj$ vng --version virtme-ng 1.31+5.g1da4504

Host OS version: hedin@laptop:~$ cat /etc/os-release PRETTY_NAME="Ubuntu 24.04.1 LTS" NAME="Ubuntu" VERSION_ID="24.04" VERSION="24.04.1 LTS (Noble Numbat)" VERSION_CODENAME=noble ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=noble LOGO=ubuntu-logo

Reproducer

1) Build the latest linux-next and run it: (virtme) hedin@laptop:~/prj$ vng -r kernelbuilds/linux-next-virtme/
_
()_ | | _
\ \ / / | | |
\ / ___
| \ / |
\ V /| | | | |_| | | | | | /__| | | | (| |
_/ ||| \
|| || ||\
| || ||__ |
|___/
kernel version: 6.12.0-rc3-next-20241018-virtme x86_64
(CTRL+d to exit)

2) Create a file on the host: hedin@laptop:~$ echo "123" > test.txt

3) Check it on the guest: hedin@virtme-ng:~$ cat test.txt
123

4) Modify it on the host by adding something: hedin@laptop:~$ vim test.txt

5) Check the changes in the guest: hedin@virtme-ng:~$ cat test.txt
cat: test.txt: Stale file handle

6) Close the editor in the host and check file on the guest one more time: hedin@virtme-ng:~$ cat test.txt
cat: test.txt: Stale file handle

7) List files in the guest: hedin@virtme-ng:~$ ls ls: cannot access 'test.txt': Stale file handle

8) Remove the file from the host: hedin@laptop:~$ rm test.txt

9) The error in the guest disappeared

arighi commented 3 hours ago

Interesting, this looks like a virtiofs bug, if you run vng --force-9p it doesn't seem to happen. I'll investigate a bit to see if it's a known bug.

Romeus commented 2 hours ago

I checked it using: vng --force-9p -r kernel_builds/linux-next-virtme/ and the issue disappeared. So, I guess that you are right - this is virtiofs-related bug.