aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/nfs4state.c14
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;