diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-04-13 00:00:04 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-04-13 10:12:01 -0400 |
commit | 04da6e9d63427b2d0fd04766712200c250b3278f (patch) | |
tree | 94045bad930d8a89f8b6e9ef8a26b6b6d0dfb3f1 /fs | |
parent | 96f6f98501196d46ce52c2697dd758d9300c63f5 (diff) |
nfsd: fix error values returned by nfsd4_lockt() when nfsd_open() fails
nfsd_open() already returns an NFS error value; only vfs_test_lock()
result needs to be fed through nfserrno(). Broken by commit 55ef12
(nfsd: Ensure nfsv4 calls the underlying filesystem on LOCKT)
three years ago...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/nfs4state.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 1841f8bf845e..7f71c69cdcdf 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -4211,16 +4211,14 @@ out: | |||
4211 | * vfs_test_lock. (Arguably perhaps test_lock should be done with an | 4211 | * vfs_test_lock. (Arguably perhaps test_lock should be done with an |
4212 | * inode operation.) | 4212 | * inode operation.) |
4213 | */ | 4213 | */ |
4214 | static int nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) | 4214 | static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) |
4215 | { | 4215 | { |
4216 | struct file *file; | 4216 | struct file *file; |
4217 | int err; | 4217 | __be32 err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); |
4218 | 4218 | if (!err) { | |
4219 | err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); | 4219 | err = nfserrno(vfs_test_lock(file, lock)); |
4220 | if (err) | 4220 | nfsd_close(file); |
4221 | return err; | 4221 | } |
4222 | err = vfs_test_lock(file, lock); | ||
4223 | nfsd_close(file); | ||
4224 | return err; | 4222 | return err; |
4225 | } | 4223 | } |
4226 | 4224 | ||
@@ -4234,7 +4232,6 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
4234 | struct inode *inode; | 4232 | struct inode *inode; |
4235 | struct file_lock file_lock; | 4233 | struct file_lock file_lock; |
4236 | struct nfs4_lockowner *lo; | 4234 | struct nfs4_lockowner *lo; |
4237 | int error; | ||
4238 | __be32 status; | 4235 | __be32 status; |
4239 | 4236 | ||
4240 | if (locks_in_grace()) | 4237 | if (locks_in_grace()) |
@@ -4280,12 +4277,10 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
4280 | 4277 | ||
4281 | nfs4_transform_lock_offset(&file_lock); | 4278 | nfs4_transform_lock_offset(&file_lock); |
4282 | 4279 | ||
4283 | status = nfs_ok; | 4280 | status = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock); |
4284 | error = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock); | 4281 | if (status) |
4285 | if (error) { | ||
4286 | status = nfserrno(error); | ||
4287 | goto out; | 4282 | goto out; |
4288 | } | 4283 | |
4289 | if (file_lock.fl_type != F_UNLCK) { | 4284 | if (file_lock.fl_type != F_UNLCK) { |
4290 | status = nfserr_denied; | 4285 | status = nfserr_denied; |
4291 | nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); | 4286 | nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); |