Date: Sat, 13 Feb 2021 20:28:14 +0000 From: bugzilla-noreply@freebsd.org To: fs@FreeBSD.org Subject: [Bug 253428] getdirentries does not work correctly on NFS mounts Message-ID: <bug-253428-3630-JZsqjq1cHo@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-253428-3630@https.bugs.freebsd.org/bugzilla/> References: <bug-253428-3630@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D253428 --- Comment #10 from Konstantin Belousov <kib@FreeBSD.org> --- (In reply to Konstantin Belousov from comment #9) Like this, untested. diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 301c583291d1..bfdc16a1df72 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -2391,11 +2391,23 @@ ufs_readdir(ap) error =3D EIO; break; } - if (offset < startoffset || dp->d_ino =3D=3D 0) + if (offset < startoffset) goto nextentry; + + /* + * In case of NFS server calling us, do not + * skip empty entries, since this keeps + * offsets consistent. + */ + if (cookies =3D=3D NULL && dp->d_ino =3D=3D 0) + goto nextentry; + dstdp.d_fileno =3D dp->d_ino; dstdp.d_reclen =3D GENERIC_DIRSIZ(&dstdp); - bcopy(dp->d_name, dstdp.d_name, dstdp.d_namlen); + if (dp->d_ino =3D=3D 0) + bzero(dp->d_name, dstdp.d_namlen); + else + bcopy(dp->d_name, dstdp.d_name, dstdp.d_namlen); /* NOTE: d_off is the offset of the *next* entry. */ dstdp.d_off =3D offset + dp->d_reclen; dirent_terminate(&dstdp); --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-253428-3630-JZsqjq1cHo>