git: 56e4622588ed - main - p9fs: fix lookup of "." for lib9p-based 9P servers

From: Doug Rabson <dfr_at_FreeBSD.org>
Date: Mon, 24 Jun 2024 13:40:56 UTC
The branch main has been updated by dfr:

URL: https://cgit.FreeBSD.org/src/commit/?id=56e4622588ed2eec0197ac47c3059d3db439f5c0

commit 56e4622588ed2eec0197ac47c3059d3db439f5c0
Author:     Doug Rabson <dfr@FreeBSD.org>
AuthorDate: 2024-06-24 11:22:57 +0000
Commit:     Doug Rabson <dfr@FreeBSD.org>
CommitDate: 2024-06-24 13:40:06 +0000

    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 <val@packett.cool>
    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 d17d7624aef1..77162c0a4aff 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;