@@ -586,7 +586,6 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
struct nlm_lock *conflock, struct nlm_cookie *cookie)
{
int error;
- int mode;
__be32 ret;
dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n",
@@ -601,8 +600,7 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
goto out;
}
- mode = lock_to_openmode(&lock->fl);
- error = vfs_test_lock(file->f_file[mode], &lock->fl);
+ error = vfs_test_lock(&lock->fl);
if (error) {
/* We can't currently deal with deferred test requests */
if (error == FILE_LOCK_DEFERRED)
@@ -2138,15 +2138,15 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
/**
* vfs_test_lock - test file byte range lock
- * @filp: The file to test lock for
* @fl: The lock to test; also used to hold result
*
* Returns -ERRNO on failure. Indicates presence of conflicting lock by
* setting conf->fl_type to something other than F_UNLCK.
*/
-int vfs_test_lock(struct file *filp, struct file_lock *fl)
+int vfs_test_lock(struct file_lock *fl)
{
- WARN_ON_ONCE(filp != fl->fl_file);
+ struct file *filp = fl->fl_file;
+
if (filp->f_op->lock)
return filp->f_op->lock(filp, F_GETLK, fl);
posix_test_lock(filp, fl);
@@ -2246,7 +2246,7 @@ int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock *flock)
fl->fl_owner = filp;
}
- error = vfs_test_lock(filp, fl);
+ error = vfs_test_lock(fl);
if (error)
goto out;
@@ -2453,7 +2453,7 @@ int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 *flock)
fl->fl_owner = filp;
}
- error = vfs_test_lock(filp, fl);
+ error = vfs_test_lock(fl);
if (error)
goto out;
@@ -7537,7 +7537,7 @@ static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct
if (err)
goto out;
lock->fl_file = nf->nf_file;
- err = nfserrno(vfs_test_lock(nf->nf_file, lock));
+ err = nfserrno(vfs_test_lock(lock));
lock->fl_file = NULL;
out:
inode_unlock(inode);
@@ -1167,7 +1167,7 @@ extern void locks_release_private(struct file_lock *);
extern void posix_test_lock(struct file *, struct file_lock *);
extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *);
extern int locks_delete_block(struct file_lock *);
-extern int vfs_test_lock(struct file *, struct file_lock *);
+extern int vfs_test_lock(struct file_lock *);
extern int vfs_lock_file(unsigned int, struct file_lock *, struct file_lock *);
extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
bool vfs_file_has_locks(struct file *file);
@@ -1269,7 +1269,7 @@ static inline int locks_delete_block(struct file_lock *waiter)
return -ENOENT;
}
-static inline int vfs_test_lock(struct file *filp, struct file_lock *fl)
+static inline int vfs_test_lock(struct file_lock *fl)
{
return 0;
}
struct file_lock already has a fl_file field that must be populated, so the @filp argument to this function is redundant. Remove it and use fl_file instead. Signed-off-by: Jeff Layton <jlayton@kernel.org> --- fs/lockd/svclock.c | 4 +--- fs/locks.c | 10 +++++----- fs/nfsd/nfs4state.c | 2 +- include/linux/fs.h | 4 ++-- 4 files changed, 9 insertions(+), 11 deletions(-)