[PATCH 3/3] filelock: remove redundant filp arg from vfs_cancel_lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 fs/lockd/svclock.c | 4 +---
 fs/locks.c         | 6 +++---
 include/linux/fs.h | 4 ++--
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index 21ee6b1c4d9e..2bced428b078 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -677,7 +677,6 @@ nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *l
 {
 	struct nlm_block	*block;
 	int status = 0;
-	int mode;
 
 	dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n",
 				nlmsvc_file_inode(file)->i_sb->s_id,
@@ -695,8 +694,7 @@ nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *l
 	if (block != NULL) {
 		struct file_lock *fl = &block->b_call->a_args.lock.fl;
 
-		mode = lock_to_openmode(fl);
-		vfs_cancel_lock(block->b_file->f_file[mode], fl);
+		vfs_cancel_lock(fl);
 		status = nlmsvc_unlink_block(block);
 		nlmsvc_release_block(block);
 	}
diff --git a/fs/locks.c b/fs/locks.c
index 0bc1808f7d98..64eeb4002bbb 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2657,14 +2657,14 @@ void locks_remove_file(struct file *filp)
 
 /**
  * vfs_cancel_lock - file byte range unblock lock
- * @filp: The file to apply the unblock to
  * @fl: The lock to be unblocked
  *
  * Used by lock managers to cancel blocked requests
  */
-int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
+int vfs_cancel_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_CANCELLK, fl);
 	return 0;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 507fa1a61bb5..d5da4c448cd8 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1169,7 +1169,7 @@ 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_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);
+extern int vfs_cancel_lock(struct file_lock *fl);
 bool vfs_file_has_locks(struct file *file);
 extern int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl);
 extern int __break_lease(struct inode *inode, unsigned int flags, unsigned int type);
@@ -1280,7 +1280,7 @@ static inline int vfs_lock_file(unsigned int cmd, struct file_lock *fl,
 	return -ENOLCK;
 }
 
-static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
+static inline int vfs_cancel_lock(struct file_lock *fl)
 {
 	return 0;
 }
-- 
2.38.1




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux