git: 8aeeb4b7f0ff - stable/14 - p9fs: Set *eofflag in p9fs_readdir()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 29 Jul 2025 12:49:20 UTC
The branch stable/14 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=8aeeb4b7f0ff21844617def38f89fe34bf05ae4c

commit 8aeeb4b7f0ff21844617def38f89fe34bf05ae4c
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-07-15 00:20:06 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-07-29 12:09:19 +0000

    p9fs: Set *eofflag in p9fs_readdir()
    
    Reviewed by:    kib
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D50760
    
    (cherry picked from commit d4cdba5b2f55b62ba1558995226dd9d93fe00af8)
---
 sys/fs/p9fs/p9fs_vnops.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c
index 56bf766ef801..227e2b93883e 100644
--- a/sys/fs/p9fs/p9fs_vnops.c
+++ b/sys/fs/p9fs/p9fs_vnops.c
@@ -1784,6 +1784,9 @@ p9fs_readdir(struct vop_readdir_args *ap)
 		return (EBADF);
 	}
 
+	if (ap->a_eofflag != NULL)
+		*ap->a_eofflag = 0;
+
 	io_buffer = uma_zalloc(p9fs_io_buffer_zone, M_WAITOK);
 
 	/* We haven't reached the end yet. read more. */
@@ -1801,8 +1804,11 @@ p9fs_readdir(struct vop_readdir_args *ap)
 		count = p9_client_readdir(vofid, (char *)io_buffer,
 		    diroffset, count);
 
-		if (count == 0)
+		if (count == 0) {
+			if (ap->a_eofflag != NULL)
+				*ap->a_eofflag = 1;
 			break;
+		}
 
 		if (count < 0) {
 			error = EIO;