Skip to content

Commit cad8533

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: fix handling of readdir in v4root vs. mount upcall timeout
If v4 READDIR operation hits a mountpoint and gets back an error, then it will include that entry in the reply and set RDATTR_ERROR for it to the error. That's fine for "normal" exported filesystems, but on the v4root, we need to be more careful to only expose the existence of dentries that lead to exports. If the mountd upcall times out while checking to see whether a mountpoint on the v4root is exported, then we have no recourse other than to fail the whole operation. Cc: Steve Dickson <steved@redhat.com> Link: https://bugzilla.kernel.org/show_bug.cgi?id=216777 Reported-by: JianHong Yin <yin-jianhong@163.com> Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Cc: <stable@vger.kernel.org>
1 parent 789e1e1 commit cad8533

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

fs/nfsd/nfs4xdr.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3629,6 +3629,17 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen,
36293629
case nfserr_noent:
36303630
xdr_truncate_encode(xdr, start_offset);
36313631
goto skip_entry;
3632+
case nfserr_jukebox:
3633+
/*
3634+
* The pseudoroot should only display dentries that lead to
3635+
* exports. If we get EJUKEBOX here, then we can't tell whether
3636+
* this entry should be included. Just fail the whole READDIR
3637+
* with NFS4ERR_DELAY in that case, and hope that the situation
3638+
* will resolve itself by the client's next attempt.
3639+
*/
3640+
if (cd->rd_fhp->fh_export->ex_flags & NFSEXP_V4ROOT)
3641+
goto fail;
3642+
fallthrough;
36323643
default:
36333644
/*
36343645
* If the client requested the RDATTR_ERROR attribute,

0 commit comments

Comments
 (0)