diff options
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 03b0578781cb..678f3be88ac0 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/nfsd/xdr4.h> | 50 | #include <linux/nfsd/xdr4.h> |
51 | #include <linux/namei.h> | 51 | #include <linux/namei.h> |
52 | #include <linux/mutex.h> | 52 | #include <linux/mutex.h> |
53 | #include <linux/lockd/bind.h> | ||
53 | 54 | ||
54 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 55 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
55 | 56 | ||
@@ -2773,7 +2774,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
2773 | /* XXX?: Just to divert the locks_release_private at the start of | 2774 | /* XXX?: Just to divert the locks_release_private at the start of |
2774 | * locks_copy_lock: */ | 2775 | * locks_copy_lock: */ |
2775 | locks_init_lock(&conflock); | 2776 | locks_init_lock(&conflock); |
2776 | err = posix_lock_file(filp, &file_lock, &conflock); | 2777 | err = vfs_lock_file(filp, cmd, &file_lock, &conflock); |
2777 | switch (-err) { | 2778 | switch (-err) { |
2778 | case 0: /* success! */ | 2779 | case 0: /* success! */ |
2779 | update_stateid(&lock_stp->st_stateid); | 2780 | update_stateid(&lock_stp->st_stateid); |
@@ -2790,7 +2791,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
2790 | status = nfserr_deadlock; | 2791 | status = nfserr_deadlock; |
2791 | break; | 2792 | break; |
2792 | default: | 2793 | default: |
2793 | dprintk("NFSD: nfsd4_lock: posix_lock_file_conf() failed! status %d\n",err); | 2794 | dprintk("NFSD: nfsd4_lock: vfs_lock_file() failed! status %d\n",err); |
2794 | status = nfserr_resource; | 2795 | status = nfserr_resource; |
2795 | break; | 2796 | break; |
2796 | } | 2797 | } |
@@ -2815,6 +2816,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
2815 | struct inode *inode; | 2816 | struct inode *inode; |
2816 | struct file file; | 2817 | struct file file; |
2817 | struct file_lock file_lock; | 2818 | struct file_lock file_lock; |
2819 | int error; | ||
2818 | __be32 status; | 2820 | __be32 status; |
2819 | 2821 | ||
2820 | if (nfs4_in_grace()) | 2822 | if (nfs4_in_grace()) |
@@ -2870,16 +2872,20 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
2870 | 2872 | ||
2871 | nfs4_transform_lock_offset(&file_lock); | 2873 | nfs4_transform_lock_offset(&file_lock); |
2872 | 2874 | ||
2873 | /* posix_test_lock uses the struct file _only_ to resolve the inode. | 2875 | /* vfs_test_lock uses the struct file _only_ to resolve the inode. |
2874 | * since LOCKT doesn't require an OPEN, and therefore a struct | 2876 | * since LOCKT doesn't require an OPEN, and therefore a struct |
2875 | * file may not exist, pass posix_test_lock a struct file with | 2877 | * file may not exist, pass vfs_test_lock a struct file with |
2876 | * only the dentry:inode set. | 2878 | * only the dentry:inode set. |
2877 | */ | 2879 | */ |
2878 | memset(&file, 0, sizeof (struct file)); | 2880 | memset(&file, 0, sizeof (struct file)); |
2879 | file.f_path.dentry = cstate->current_fh.fh_dentry; | 2881 | file.f_path.dentry = cstate->current_fh.fh_dentry; |
2880 | 2882 | ||
2881 | status = nfs_ok; | 2883 | status = nfs_ok; |
2882 | posix_test_lock(&file, &file_lock); | 2884 | error = vfs_test_lock(&file, &file_lock); |
2885 | if (error) { | ||
2886 | status = nfserrno(error); | ||
2887 | goto out; | ||
2888 | } | ||
2883 | if (file_lock.fl_type != F_UNLCK) { | 2889 | if (file_lock.fl_type != F_UNLCK) { |
2884 | status = nfserr_denied; | 2890 | status = nfserr_denied; |
2885 | nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); | 2891 | nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); |
@@ -2935,9 +2941,9 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
2935 | /* | 2941 | /* |
2936 | * Try to unlock the file in the VFS. | 2942 | * Try to unlock the file in the VFS. |
2937 | */ | 2943 | */ |
2938 | err = posix_lock_file(filp, &file_lock, NULL); | 2944 | err = vfs_lock_file(filp, F_SETLK, &file_lock, NULL); |
2939 | if (err) { | 2945 | if (err) { |
2940 | dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n"); | 2946 | dprintk("NFSD: nfs4_locku: vfs_lock_file failed!\n"); |
2941 | goto out_nfserr; | 2947 | goto out_nfserr; |
2942 | } | 2948 | } |
2943 | /* | 2949 | /* |