diff options
author | Andy Adamson <andros@citi.umich.edu> | 2006-01-18 20:43:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-18 22:20:24 -0500 |
commit | a6f6ef2f1d7329111fcad7db48fb7adba5062d0a (patch) | |
tree | 7fd08104892870699c8f191e2e23b753b5b119d5 /fs | |
parent | 1918e341383ab787d6c5b17200f4ed901b10c777 (diff) |
[PATCH] nfsd4: misc lock fixes
Logic fixes for LOCK and UNLOCK.
- Move the permission check on the current file handle outside of
nfs4_lock_state()
- remove the file manager fl_release_private calls; fl_ops is not set.
Signed-off-by: Andy Adamson <andros@citi.umich.edu>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4state.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 6bbefd06f10d..3d4a2ec97caa 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -2700,6 +2700,11 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock | |||
2700 | if (check_lock_length(lock->lk_offset, lock->lk_length)) | 2700 | if (check_lock_length(lock->lk_offset, lock->lk_length)) |
2701 | return nfserr_inval; | 2701 | return nfserr_inval; |
2702 | 2702 | ||
2703 | if ((status = fh_verify(rqstp, current_fh, S_IFREG, MAY_LOCK))) { | ||
2704 | dprintk("NFSD: nfsd4_lock: permission denied!\n"); | ||
2705 | return status; | ||
2706 | } | ||
2707 | |||
2703 | nfs4_lock_state(); | 2708 | nfs4_lock_state(); |
2704 | 2709 | ||
2705 | if (lock->lk_is_new) { | 2710 | if (lock->lk_is_new) { |
@@ -2757,11 +2762,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock | |||
2757 | /* lock->lk_stateowner and lock_stp have been created or found */ | 2762 | /* lock->lk_stateowner and lock_stp have been created or found */ |
2758 | filp = lock_stp->st_vfs_file; | 2763 | filp = lock_stp->st_vfs_file; |
2759 | 2764 | ||
2760 | if ((status = fh_verify(rqstp, current_fh, S_IFREG, MAY_LOCK))) { | ||
2761 | dprintk("NFSD: nfsd4_lock: permission denied!\n"); | ||
2762 | goto out; | ||
2763 | } | ||
2764 | |||
2765 | status = nfserr_grace; | 2765 | status = nfserr_grace; |
2766 | if (nfs4_in_grace() && !lock->lk_reclaim) | 2766 | if (nfs4_in_grace() && !lock->lk_reclaim) |
2767 | goto out; | 2767 | goto out; |
@@ -2802,8 +2802,6 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock | |||
2802 | */ | 2802 | */ |
2803 | 2803 | ||
2804 | status = posix_lock_file(filp, &file_lock); | 2804 | status = posix_lock_file(filp, &file_lock); |
2805 | if (file_lock.fl_ops && file_lock.fl_ops->fl_release_private) | ||
2806 | file_lock.fl_ops->fl_release_private(&file_lock); | ||
2807 | dprintk("NFSD: nfsd4_lock: posix_lock_file status %d\n",status); | 2805 | dprintk("NFSD: nfsd4_lock: posix_lock_file status %d\n",status); |
2808 | switch (-status) { | 2806 | switch (-status) { |
2809 | case 0: /* success! */ | 2807 | case 0: /* success! */ |
@@ -2977,8 +2975,6 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock | |||
2977 | * Try to unlock the file in the VFS. | 2975 | * Try to unlock the file in the VFS. |
2978 | */ | 2976 | */ |
2979 | status = posix_lock_file(filp, &file_lock); | 2977 | status = posix_lock_file(filp, &file_lock); |
2980 | if (file_lock.fl_ops && file_lock.fl_ops->fl_release_private) | ||
2981 | file_lock.fl_ops->fl_release_private(&file_lock); | ||
2982 | if (status) { | 2978 | if (status) { |
2983 | dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n"); | 2979 | dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n"); |
2984 | goto out_nfserr; | 2980 | goto out_nfserr; |