diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-01-26 15:42:30 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-01-26 15:42:30 -0500 |
commit | 8e469ebd6dc32cbaf620e134d79f740bf0ebab79 (patch) | |
tree | a83e806a7cfa0a57ba6e55aef6da027aa2f08fee /fs/nfs/nfs4proc.c | |
parent | 2bee72a6aa1e6d0a4f5da56217f0d0bbbdd0d9a3 (diff) |
NFSv4: Don't allow posix locking against servers that don't support it
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: stable@kernel.org
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 0b68238ed0c8..be044b58e811 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1658,6 +1658,8 @@ static int _nfs4_do_open(struct inode *dir, struct path *path, fmode_t fmode, in | |||
1658 | status = PTR_ERR(state); | 1658 | status = PTR_ERR(state); |
1659 | if (IS_ERR(state)) | 1659 | if (IS_ERR(state)) |
1660 | goto err_opendata_put; | 1660 | goto err_opendata_put; |
1661 | if ((opendata->o_res.rflags & NFS4_OPEN_RESULT_LOCKTYPE_POSIX) != 0) | ||
1662 | set_bit(NFS_STATE_POSIX_LOCKS, &state->flags); | ||
1661 | nfs4_opendata_put(opendata); | 1663 | nfs4_opendata_put(opendata); |
1662 | nfs4_put_state_owner(sp); | 1664 | nfs4_put_state_owner(sp); |
1663 | *res = state; | 1665 | *res = state; |
@@ -4200,8 +4202,11 @@ static int _nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock | |||
4200 | { | 4202 | { |
4201 | struct nfs_inode *nfsi = NFS_I(state->inode); | 4203 | struct nfs_inode *nfsi = NFS_I(state->inode); |
4202 | unsigned char fl_flags = request->fl_flags; | 4204 | unsigned char fl_flags = request->fl_flags; |
4203 | int status; | 4205 | int status = -ENOLCK; |
4204 | 4206 | ||
4207 | if ((fl_flags & FL_POSIX) && | ||
4208 | !test_bit(NFS_STATE_POSIX_LOCKS, &state->flags)) | ||
4209 | goto out; | ||
4205 | /* Is this a delegated open? */ | 4210 | /* Is this a delegated open? */ |
4206 | status = nfs4_set_lock_state(state, request); | 4211 | status = nfs4_set_lock_state(state, request); |
4207 | if (status != 0) | 4212 | if (status != 0) |