From dac772390752f42575f99d7b00a4c8e8b8ff8dee Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Mon, 24 Jun 2024 12:22:57 +0100 Subject: [PATCH] p9fs: fix lookup of "." for lib9p-based 9P servers The lib9p implementation takes a strict interpretation of the Twalk RPC call and returns an error for attempts to lookup ".". The workaround is to fake the lookup locally. Reviewed by: Val Packett MFC after: 3 months --- sys/fs/p9fs/p9fs_vnops.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c index d17d7624aef..77162c0a4af 100644 --- a/sys/fs/p9fs/p9fs_vnops.c +++ b/sys/fs/p9fs/p9fs_vnops.c @@ -243,6 +243,12 @@ p9fs_lookup(struct vop_lookup_args *ap) if (dnp == NULL) return (ENOENT); + if (cnp->cn_nameptr[0] == '.' && strlen(cnp->cn_nameptr) == 1) { + vref(dvp); + *vpp = dvp; + return (0); + } + vses = dnp->p9fs_ses; mp = vses->p9fs_mount;