diff options
author | J. Bruce Fields <bfields@redhat.com> | 2021-08-23 16:44:00 -0400 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2021-08-23 18:05:31 -0400 |
commit | 7f024fcd5c97dc70bb9121c80407cf3cf9be7159 (patch) | |
tree | 069bd48a61ba4d33bd1f981e3e9d616c262030b5 /fs/lockd/svcproc.c | |
parent | b661601a9fdf1af8516e1100de8bba84bd41cca4 (diff) | |
download | linux-7f024fcd5c97dc70bb9121c80407cf3cf9be7159.tar.bz2 |
Keep read and write fds with each nlm_file
We shouldn't really be using a read-only file descriptor to take a write
lock.
Most filesystems will put up with it. But NFS, for example, won't.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/lockd/svcproc.c')
-rw-r--r-- | fs/lockd/svcproc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index f4e5e0eb30fd..99696d3f6dd6 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c @@ -55,6 +55,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, struct nlm_host *host = NULL; struct nlm_file *file = NULL; struct nlm_lock *lock = &argp->lock; + int mode; __be32 error = 0; /* nfsd callbacks must have been installed for this procedure */ @@ -75,7 +76,8 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp, *filp = file; /* Set up the missing parts of the file_lock structure */ - lock->fl.fl_file = file->f_file; + mode = lock_to_openmode(&lock->fl); + lock->fl.fl_file = file->f_file[mode]; lock->fl.fl_pid = current->tgid; lock->fl.fl_lmops = &nlmsvc_lock_operations; nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); |