diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2023-11-19 20:17:11 -0500 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2024-01-07 17:54:25 -0500 |
commit | a853ed552545e116cf9b197b8c3c5cec80077f1e (patch) | |
tree | 23d81bb342f0171bfe0c67b24cd8703ff522775d /fs | |
parent | d0ab8b649ba7636d181605e31bf3e42b0784bc67 (diff) |
NFSD: Document lack of f_pos_lock in nfsd_readdir()
Al Viro notes that normal system calls hold f_pos_lock when calling
->iterate_shared and ->llseek; however nfsd_readdir() does not take
that mutex when calling these methods.
It should be safe however because the struct file acquired by
nfsd_readdir() is not visible to other threads.
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/vfs.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index e01e4e2acbd9..c260cbfa8176 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -2102,9 +2102,23 @@ static __be32 nfsd_buffered_readdir(struct file *file, struct svc_fh *fhp, return cdp->err; } -/* - * Read entries from a directory. - * The NFSv3/4 verifier we ignore for now. +/** + * nfsd_readdir - Read entries from a directory + * @rqstp: RPC transaction context + * @fhp: NFS file handle of directory to be read + * @offsetp: OUT: seek offset of final entry that was read + * @cdp: OUT: an eof error value + * @func: entry filler actor + * + * This implementation ignores the NFSv3/4 verifier cookie. + * + * NB: normal system calls hold file->f_pos_lock when calling + * ->iterate_shared and ->llseek, but nfsd_readdir() does not. + * Because the struct file acquired here is not visible to other + * threads, it's internal state does not need mutex protection. + * + * Returns nfs_ok on success, otherwise an nfsstat code is + * returned. */ __be32 nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, |