Re: [GIT PULL] fs/9p patches for 6.9 merge window

From: Oleg Nesterov
Date: Mon Apr 08 2024 - 10:16:23 EST


Hello,

the commit 724a08450f74 ("fs/9p: simplify iget to remove unnecessary paths")
from this PR breaks my setup.

On the host:

$ cat /etc/fstab
/dev/mapper/volgrp-root / ext4 defaults 1 1
/dev/mapper/volgrp-home /home ext4 defaults 1 2

$ qemu-system-x86_64 -kernel ./arch/x86/boot/bzImage \
-append 'rw rootfstype=9p rootflags=version=9p2000.L,trans=virtio' \
-fsdev local,id=FSID_1,path=/home/oleg/TEST_GUEST/,security_model=none \
-device virtio-9p-pci,fsdev=FSID_1,mount_tag=/dev/root \
-fsdev local,id=FSID_2,path=/,security_model=none,readonly \
-device virtio-9p-pci,fsdev=FSID_2,mount_tag=hostfs \
-nographic -serial mon:stdio

In the guest:

# mount -t 9p hostfs /host -o version=9p2000.L,trans=virtio,access=any

Now, before this patch:

/# cd /host
/host# strace -e stat perl -e '-d "home"'
...
stat("home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
+++ exited with 0 +++
/host# cd home
/host/home#

After this patch:

# cd /host
/host# strace -e stat perl -e '-d "home"'
...
stat("home", 0x1397298) = -1 ELOOP (Too many levels of symbolic links)
+++ exited with 0 +++
/host# cd home
-bash: cd: home: Too many levels of symbolic links
/host# dmesg
...
[ 54.255756] VFS: Lookup of 'home' in 9p 9p would have caused loop
[ 72.190399] VFS: Lookup of 'home' in 9p 9p would have caused loop
[ 72.191535] VFS: Lookup of 'home' in 9p 9p would have caused loop
[ 72.192488] VFS: Lookup of 'home' in 9p 9p would have caused loop

Oleg.


On 03/15, Eric Van Hensbergen wrote:
>
> The following changes since commit 6613476e225e090cc9aad49be7fa504e290dd33d:
>
> Linux 6.8-rc1 (2024-01-21 14:11:32 -0800)
>
> are available in the Git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs.git tags/9p-for-6.9
>
> for you to fetch changes up to be57855f505003c5cafff40338d5d0f23b00ba4d:
>
> fs/9p: fix dups even in uncached mode (2024-01-26 16:46:56 +0000)
>
> ----------------------------------------------------------------
> fs/9p changes for the 6.9 merge window
>
> This pull request includes a number of patches
> addressing improvements in the cache portions of the 9p
> client.
>
> The biggest improvements have to do with fixing handling
> of inodes and eliminating duplicate structures and unnecessary
> allocation/release of inode structures and many associated
> unnecessary protocol traffic. This also dramatically
> reduced code complexity across the code and sets us up to add
> proper temporal cache capabilities.
>
> Signed-off-by: Eric Van Hensbergen <ericvh@xxxxxxxxxx>
>
> ----------------------------------------------------------------
> Eric Van Hensbergen (8):
> fs/9p: switch vfsmount to use v9fs_get_new_inode
> fs/9p: convert mkdir to use get_new_inode
> fs/9p: remove walk and inode allocation from symlink
> fs/9p: Eliminate redundant non-cache path in mknod
> fs/9p: Eliminate now unused v9fs_get_inode
> fs/9p: rework qid2ino logic
> fs/9p: simplify iget to remove unnecessary paths
> fs/9p: fix dups even in uncached mode
>
> fs/9p/v9fs.h | 31 +++++-----------------------
> fs/9p/v9fs_vfs.h | 11 ++++++----
> fs/9p/vfs_dir.c | 4 ++--
> fs/9p/vfs_inode.c | 150 +++++++++++++++++++--------------------------------------------------------------------------------------------------------------------
> fs/9p/vfs_inode_dotl.c | 194 ++++++++++++++++++++++++++++++++-----------------------------------------------------------------------------------------------------------------------------------------------
> fs/9p/vfs_super.c | 45 +----------------------------------------
> 6 files changed, 71 insertions(+), 364 deletions(-)