aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs4state.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 2d03a4188671..a91e521622c3 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4876,9 +4876,25 @@ nfs4_transform_lock_offset(struct file_lock *lock)
4876 lock->fl_end = OFFSET_MAX; 4876 lock->fl_end = OFFSET_MAX;
4877} 4877}
4878 4878
4879/* Hack!: For now, we're defining this just so we can use a pointer to it 4879static void nfsd4_fl_get_owner(struct file_lock *dst, struct file_lock *src)
4880 * as a unique cookie to identify our (NFSv4's) posix locks. */ 4880{
4881 struct nfs4_lockowner *lo = (struct nfs4_lockowner *)src->fl_owner;
4882 dst->fl_owner = (fl_owner_t)lockowner(nfs4_get_stateowner(&lo->lo_owner));
4883}
4884
4885static void nfsd4_fl_put_owner(struct file_lock *fl)
4886{
4887 struct nfs4_lockowner *lo = (struct nfs4_lockowner *)fl->fl_owner;
4888
4889 if (lo) {
4890 nfs4_put_stateowner(&lo->lo_owner);
4891 fl->fl_owner = NULL;
4892 }
4893}
4894
4881static const struct lock_manager_operations nfsd_posix_mng_ops = { 4895static const struct lock_manager_operations nfsd_posix_mng_ops = {
4896 .lm_get_owner = nfsd4_fl_get_owner,
4897 .lm_put_owner = nfsd4_fl_put_owner,
4882}; 4898};
4883 4899
4884static inline void 4900static inline void
@@ -5243,7 +5259,8 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
5243 status = nfserr_openmode; 5259 status = nfserr_openmode;
5244 goto out; 5260 goto out;
5245 } 5261 }
5246 file_lock->fl_owner = (fl_owner_t)lock_sop; 5262
5263 file_lock->fl_owner = (fl_owner_t)lockowner(nfs4_get_stateowner(&lock_sop->lo_owner));
5247 file_lock->fl_pid = current->tgid; 5264 file_lock->fl_pid = current->tgid;
5248 file_lock->fl_file = filp; 5265 file_lock->fl_file = filp;
5249 file_lock->fl_flags = FL_POSIX; 5266 file_lock->fl_flags = FL_POSIX;
@@ -5439,7 +5456,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
5439 } 5456 }
5440 5457
5441 file_lock->fl_type = F_UNLCK; 5458 file_lock->fl_type = F_UNLCK;
5442 file_lock->fl_owner = (fl_owner_t)lockowner(stp->st_stateowner); 5459 file_lock->fl_owner = (fl_owner_t)lockowner(nfs4_get_stateowner(stp->st_stateowner));
5443 file_lock->fl_pid = current->tgid; 5460 file_lock->fl_pid = current->tgid;
5444 file_lock->fl_file = filp; 5461 file_lock->fl_file = filp;
5445 file_lock->fl_flags = FL_POSIX; 5462 file_lock->fl_flags = FL_POSIX;