All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Minor cleanup for locks API
@ 2015-10-22 15:35 ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Latchesar Ionkov, linux-fsdevel, Trond Myklebust, devel,
	Yan Zheng, cluster-devel, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel, Christine Caulfield,
	v9fs-developer, Ilya Dryomov, linux-cifs, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel, Abdul Hussain, Steven Whitehouse,
	linux-nfs, Andreas Dilger, Greg

NFS has recently been moving things around to cope with the situation where
a struct file may not be available during an unlock.  That work has
presented an opportunity to do a minor cleanup on the locks API.

Users of posix_lock_file_wait() (for FL_POSIX style locks) and
flock_lock_file_wait() (for FL_FLOCK style locks) can instead call
locks_lock_file_wait() for both lock types.  Because the passed-in file_lock
specifies its own type, the correct function can be selected on behalf of
the user.

This work allows further cleanup within NFS and lockd which will be
submitted separately.

Benjamin Coddington (3):
  locks: introduce locks_lock_inode_wait()
  Move locks API users to locks_lock_inode_wait()
  locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait

 drivers/staging/lustre/lustre/llite/file.c |    8 +-----
 fs/9p/vfs_file.c                           |    4 +-
 fs/ceph/locks.c                            |    4 +-
 fs/cifs/file.c                             |    2 +-
 fs/dlm/plock.c                             |    4 +-
 fs/fuse/file.c                             |    2 +-
 fs/gfs2/file.c                             |    8 +++---
 fs/lockd/clntproc.c                        |   13 +----------
 fs/locks.c                                 |   31 +++++++++++++++++++++++----
 fs/nfs/file.c                              |   13 +----------
 fs/nfs/nfs4proc.c                          |   13 +----------
 fs/ocfs2/locks.c                           |    8 +++---
 include/linux/fs.h                         |   21 +++---------------
 13 files changed, 51 insertions(+), 80 deletions(-)

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 0/3] Minor cleanup for locks API
@ 2015-10-22 15:35 ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Christoph Hellwig, Oleg Drokin, Andreas Dilger,
	Greg Kroah-Hartman, Eric Van Hensbergen, Ron Minnich,
	Latchesar Ionkov, Yan Zheng, Sage Weil, Ilya Dryomov,
	Steve French, Christine Caulfield, David Teigland,
	Miklos Szeredi, Steven Whitehouse, Bob Peterson, Trond Myklebust,
	Anna Schumaker, Mark Fasheh, Joel Becker, aybuke ozdemir,
	Julia Lawall, Abdul Hussain, lustre-devel, devel, linux-kernel,
	v9fs-developer, ceph-devel, linux-cifs, samba-technical,
	cluster-devel, fuse-devel, linux-nfs, linux-fsdevel, ocfs2-devel

NFS has recently been moving things around to cope with the situation where
a struct file may not be available during an unlock.  That work has
presented an opportunity to do a minor cleanup on the locks API.

Users of posix_lock_file_wait() (for FL_POSIX style locks) and
flock_lock_file_wait() (for FL_FLOCK style locks) can instead call
locks_lock_file_wait() for both lock types.  Because the passed-in file_lock
specifies its own type, the correct function can be selected on behalf of
the user.

This work allows further cleanup within NFS and lockd which will be
submitted separately.

Benjamin Coddington (3):
  locks: introduce locks_lock_inode_wait()
  Move locks API users to locks_lock_inode_wait()
  locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait

 drivers/staging/lustre/lustre/llite/file.c |    8 +-----
 fs/9p/vfs_file.c                           |    4 +-
 fs/ceph/locks.c                            |    4 +-
 fs/cifs/file.c                             |    2 +-
 fs/dlm/plock.c                             |    4 +-
 fs/fuse/file.c                             |    2 +-
 fs/gfs2/file.c                             |    8 +++---
 fs/lockd/clntproc.c                        |   13 +----------
 fs/locks.c                                 |   31 +++++++++++++++++++++++----
 fs/nfs/file.c                              |   13 +----------
 fs/nfs/nfs4proc.c                          |   13 +----------
 fs/ocfs2/locks.c                           |    8 +++---
 include/linux/fs.h                         |   21 +++---------------
 13 files changed, 51 insertions(+), 80 deletions(-)


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 0/3] Minor cleanup for locks API
@ 2015-10-22 15:35 ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Latchesar Ionkov, linux-fsdevel, Trond Myklebust, devel,
	Yan Zheng, cluster-devel, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel, Christine Caulfield,
	v9fs-developer, Ilya Dryomov, linux-cifs, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel, Abdul Hussain, Steven Whitehouse,
	linux-nfs, Andreas Dilger, Greg

NFS has recently been moving things around to cope with the situation where
a struct file may not be available during an unlock.  That work has
presented an opportunity to do a minor cleanup on the locks API.

Users of posix_lock_file_wait() (for FL_POSIX style locks) and
flock_lock_file_wait() (for FL_FLOCK style locks) can instead call
locks_lock_file_wait() for both lock types.  Because the passed-in file_lock
specifies its own type, the correct function can be selected on behalf of
the user.

This work allows further cleanup within NFS and lockd which will be
submitted separately.

Benjamin Coddington (3):
  locks: introduce locks_lock_inode_wait()
  Move locks API users to locks_lock_inode_wait()
  locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait

 drivers/staging/lustre/lustre/llite/file.c |    8 +-----
 fs/9p/vfs_file.c                           |    4 +-
 fs/ceph/locks.c                            |    4 +-
 fs/cifs/file.c                             |    2 +-
 fs/dlm/plock.c                             |    4 +-
 fs/fuse/file.c                             |    2 +-
 fs/gfs2/file.c                             |    8 +++---
 fs/lockd/clntproc.c                        |   13 +----------
 fs/locks.c                                 |   31 +++++++++++++++++++++++----
 fs/nfs/file.c                              |   13 +----------
 fs/nfs/nfs4proc.c                          |   13 +----------
 fs/ocfs2/locks.c                           |    8 +++---
 include/linux/fs.h                         |   21 +++---------------
 13 files changed, 51 insertions(+), 80 deletions(-)

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [lustre-devel] [PATCH 0/3] Minor cleanup for locks API
@ 2015-10-22 15:35 ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: lustre-devel

NFS has recently been moving things around to cope with the situation where
a struct file may not be available during an unlock.  That work has
presented an opportunity to do a minor cleanup on the locks API.

Users of posix_lock_file_wait() (for FL_POSIX style locks) and
flock_lock_file_wait() (for FL_FLOCK style locks) can instead call
locks_lock_file_wait() for both lock types.  Because the passed-in file_lock
specifies its own type, the correct function can be selected on behalf of
the user.

This work allows further cleanup within NFS and lockd which will be
submitted separately.

Benjamin Coddington (3):
  locks: introduce locks_lock_inode_wait()
  Move locks API users to locks_lock_inode_wait()
  locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait

 drivers/staging/lustre/lustre/llite/file.c |    8 +-----
 fs/9p/vfs_file.c                           |    4 +-
 fs/ceph/locks.c                            |    4 +-
 fs/cifs/file.c                             |    2 +-
 fs/dlm/plock.c                             |    4 +-
 fs/fuse/file.c                             |    2 +-
 fs/gfs2/file.c                             |    8 +++---
 fs/lockd/clntproc.c                        |   13 +----------
 fs/locks.c                                 |   31 +++++++++++++++++++++++----
 fs/nfs/file.c                              |   13 +----------
 fs/nfs/nfs4proc.c                          |   13 +----------
 fs/ocfs2/locks.c                           |    8 +++---
 include/linux/fs.h                         |   21 +++---------------
 13 files changed, 51 insertions(+), 80 deletions(-)

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Cluster-devel] [PATCH 0/3] Minor cleanup for locks API
@ 2015-10-22 15:35 ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: cluster-devel.redhat.com

NFS has recently been moving things around to cope with the situation where
a struct file may not be available during an unlock.  That work has
presented an opportunity to do a minor cleanup on the locks API.

Users of posix_lock_file_wait() (for FL_POSIX style locks) and
flock_lock_file_wait() (for FL_FLOCK style locks) can instead call
locks_lock_file_wait() for both lock types.  Because the passed-in file_lock
specifies its own type, the correct function can be selected on behalf of
the user.

This work allows further cleanup within NFS and lockd which will be
submitted separately.

Benjamin Coddington (3):
  locks: introduce locks_lock_inode_wait()
  Move locks API users to locks_lock_inode_wait()
  locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait

 drivers/staging/lustre/lustre/llite/file.c |    8 +-----
 fs/9p/vfs_file.c                           |    4 +-
 fs/ceph/locks.c                            |    4 +-
 fs/cifs/file.c                             |    2 +-
 fs/dlm/plock.c                             |    4 +-
 fs/fuse/file.c                             |    2 +-
 fs/gfs2/file.c                             |    8 +++---
 fs/lockd/clntproc.c                        |   13 +----------
 fs/locks.c                                 |   31 +++++++++++++++++++++++----
 fs/nfs/file.c                              |   13 +----------
 fs/nfs/nfs4proc.c                          |   13 +----------
 fs/ocfs2/locks.c                           |    8 +++---
 include/linux/fs.h                         |   21 +++---------------
 13 files changed, 51 insertions(+), 80 deletions(-)



^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 1/3] locks: introduce locks_lock_inode_wait()
  2015-10-22 15:35 ` Benjamin Coddington
                     ` (2 preceding siblings ...)
  (?)
@ 2015-10-22 15:35   ` Benjamin Coddington
  -1 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Latchesar Ionkov, linux-fsdevel, Trond Myklebust, devel,
	Yan Zheng, cluster-devel, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel, Christine Caulfield,
	v9fs-developer, Ilya Dryomov, linux-cifs, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel, Abdul Hussain, Steven Whitehouse,
	linux-nfs, Andreas Dilger, Greg

Users of the locks API commonly call either posix_lock_file_wait() or
flock_lock_file_wait() depending upon the lock type.  Add a new function
locks_lock_inode_wait() which will check and call the correct function for
the type of lock passed in.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/locks.c         |   24 ++++++++++++++++++++++++
 include/linux/fs.h |   11 +++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 2a54c80..68b1784 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1876,6 +1876,30 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 EXPORT_SYMBOL(flock_lock_inode_wait);
 
 /**
+ * locks_lock_inode_wait - Apply a lock to an inode
+ * @inode: inode of the file to apply to
+ * @fl: The lock to be applied
+ *
+ * Apply a POSIX or FLOCK style lock request to an inode.
+ */
+int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+{
+	int res = 0;
+	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
+		case FL_POSIX:
+			res = posix_lock_inode_wait(inode, fl);
+			break;
+		case FL_FLOCK:
+			res = flock_lock_inode_wait(inode, fl);
+			break;
+		default:
+			BUG();
+	}
+	return res;
+}
+EXPORT_SYMBOL(locks_lock_inode_wait);
+
+/**
  *	sys_flock: - flock() system call.
  *	@fd: the file descriptor to lock.
  *	@cmd: the type of lock to apply.
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 72d8a84..2e283b7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1059,6 +1059,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
 extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
 extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
 extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
+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);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
 extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
@@ -1177,6 +1178,11 @@ static inline int flock_lock_inode_wait(struct inode *inode,
 	return -ENOLCK;
 }
 
+static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
+{
+	return -ENOLCK;
+}
+
 static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
 {
 	return 0;
@@ -1225,6 +1231,11 @@ static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
 	return flock_lock_inode_wait(file_inode(filp), fl);
 }
 
+static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
+{
+	return locks_lock_inode_wait(file_inode(filp), fl);
+}
+
 struct fasync_struct {
 	spinlock_t		fa_lock;
 	int			magic;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 1/3] locks: introduce locks_lock_inode_wait()
@ 2015-10-22 15:35   ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Christoph Hellwig, Oleg Drokin, Andreas Dilger,
	Greg Kroah-Hartman, Eric Van Hensbergen, Ron Minnich,
	Latchesar Ionkov, Yan Zheng, Sage Weil, Ilya Dryomov,
	Steve French, Christine Caulfield, David Teigland,
	Miklos Szeredi, Steven Whitehouse, Bob Peterson, Trond Myklebust,
	Anna Schumaker, Mark Fasheh, Joel Becker, aybuke ozdemir,
	Julia Lawall, Abdul Hussain, lustre-devel, devel, linux-kernel,
	v9fs-developer, ceph-devel, linux-cifs, samba-technical,
	cluster-devel, fuse-devel, linux-nfs, linux-fsdevel, ocfs2-devel

Users of the locks API commonly call either posix_lock_file_wait() or
flock_lock_file_wait() depending upon the lock type.  Add a new function
locks_lock_inode_wait() which will check and call the correct function for
the type of lock passed in.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/locks.c         |   24 ++++++++++++++++++++++++
 include/linux/fs.h |   11 +++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 2a54c80..68b1784 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1876,6 +1876,30 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 EXPORT_SYMBOL(flock_lock_inode_wait);
 
 /**
+ * locks_lock_inode_wait - Apply a lock to an inode
+ * @inode: inode of the file to apply to
+ * @fl: The lock to be applied
+ *
+ * Apply a POSIX or FLOCK style lock request to an inode.
+ */
+int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+{
+	int res = 0;
+	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
+		case FL_POSIX:
+			res = posix_lock_inode_wait(inode, fl);
+			break;
+		case FL_FLOCK:
+			res = flock_lock_inode_wait(inode, fl);
+			break;
+		default:
+			BUG();
+	}
+	return res;
+}
+EXPORT_SYMBOL(locks_lock_inode_wait);
+
+/**
  *	sys_flock: - flock() system call.
  *	@fd: the file descriptor to lock.
  *	@cmd: the type of lock to apply.
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 72d8a84..2e283b7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1059,6 +1059,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
 extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
 extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
 extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
+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);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
 extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
@@ -1177,6 +1178,11 @@ static inline int flock_lock_inode_wait(struct inode *inode,
 	return -ENOLCK;
 }
 
+static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
+{
+	return -ENOLCK;
+}
+
 static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
 {
 	return 0;
@@ -1225,6 +1231,11 @@ static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
 	return flock_lock_inode_wait(file_inode(filp), fl);
 }
 
+static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
+{
+	return locks_lock_inode_wait(file_inode(filp), fl);
+}
+
 struct fasync_struct {
 	spinlock_t		fa_lock;
 	int			magic;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 1/3] locks: introduce locks_lock_inode_wait()
@ 2015-10-22 15:35   ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Latchesar Ionkov, linux-fsdevel, Trond Myklebust, devel,
	Yan Zheng, cluster-devel, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel, Christine Caulfield,
	v9fs-developer, Ilya Dryomov, linux-cifs, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel, Abdul Hussain, Steven Whitehouse,
	linux-nfs, Andreas Dilger, Greg

Users of the locks API commonly call either posix_lock_file_wait() or
flock_lock_file_wait() depending upon the lock type.  Add a new function
locks_lock_inode_wait() which will check and call the correct function for
the type of lock passed in.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/locks.c         |   24 ++++++++++++++++++++++++
 include/linux/fs.h |   11 +++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 2a54c80..68b1784 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1876,6 +1876,30 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 EXPORT_SYMBOL(flock_lock_inode_wait);
 
 /**
+ * locks_lock_inode_wait - Apply a lock to an inode
+ * @inode: inode of the file to apply to
+ * @fl: The lock to be applied
+ *
+ * Apply a POSIX or FLOCK style lock request to an inode.
+ */
+int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+{
+	int res = 0;
+	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
+		case FL_POSIX:
+			res = posix_lock_inode_wait(inode, fl);
+			break;
+		case FL_FLOCK:
+			res = flock_lock_inode_wait(inode, fl);
+			break;
+		default:
+			BUG();
+	}
+	return res;
+}
+EXPORT_SYMBOL(locks_lock_inode_wait);
+
+/**
  *	sys_flock: - flock() system call.
  *	@fd: the file descriptor to lock.
  *	@cmd: the type of lock to apply.
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 72d8a84..2e283b7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1059,6 +1059,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
 extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
 extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
 extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
+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);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
 extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
@@ -1177,6 +1178,11 @@ static inline int flock_lock_inode_wait(struct inode *inode,
 	return -ENOLCK;
 }
 
+static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
+{
+	return -ENOLCK;
+}
+
 static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
 {
 	return 0;
@@ -1225,6 +1231,11 @@ static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
 	return flock_lock_inode_wait(file_inode(filp), fl);
 }
 
+static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
+{
+	return locks_lock_inode_wait(file_inode(filp), fl);
+}
+
 struct fasync_struct {
 	spinlock_t		fa_lock;
 	int			magic;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [lustre-devel] [PATCH 1/3] locks: introduce locks_lock_inode_wait()
@ 2015-10-22 15:35   ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: lustre-devel

Users of the locks API commonly call either posix_lock_file_wait() or
flock_lock_file_wait() depending upon the lock type.  Add a new function
locks_lock_inode_wait() which will check and call the correct function for
the type of lock passed in.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/locks.c         |   24 ++++++++++++++++++++++++
 include/linux/fs.h |   11 +++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 2a54c80..68b1784 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1876,6 +1876,30 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 EXPORT_SYMBOL(flock_lock_inode_wait);
 
 /**
+ * locks_lock_inode_wait - Apply a lock to an inode
+ * @inode: inode of the file to apply to
+ * @fl: The lock to be applied
+ *
+ * Apply a POSIX or FLOCK style lock request to an inode.
+ */
+int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+{
+	int res = 0;
+	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
+		case FL_POSIX:
+			res = posix_lock_inode_wait(inode, fl);
+			break;
+		case FL_FLOCK:
+			res = flock_lock_inode_wait(inode, fl);
+			break;
+		default:
+			BUG();
+	}
+	return res;
+}
+EXPORT_SYMBOL(locks_lock_inode_wait);
+
+/**
  *	sys_flock: - flock() system call.
  *	@fd: the file descriptor to lock.
  *	@cmd: the type of lock to apply.
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 72d8a84..2e283b7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1059,6 +1059,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
 extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
 extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
 extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
+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);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
 extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
@@ -1177,6 +1178,11 @@ static inline int flock_lock_inode_wait(struct inode *inode,
 	return -ENOLCK;
 }
 
+static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
+{
+	return -ENOLCK;
+}
+
 static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
 {
 	return 0;
@@ -1225,6 +1231,11 @@ static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
 	return flock_lock_inode_wait(file_inode(filp), fl);
 }
 
+static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
+{
+	return locks_lock_inode_wait(file_inode(filp), fl);
+}
+
 struct fasync_struct {
 	spinlock_t		fa_lock;
 	int			magic;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [Cluster-devel] [PATCH 1/3] locks: introduce locks_lock_inode_wait()
@ 2015-10-22 15:35   ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Users of the locks API commonly call either posix_lock_file_wait() or
flock_lock_file_wait() depending upon the lock type.  Add a new function
locks_lock_inode_wait() which will check and call the correct function for
the type of lock passed in.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/locks.c         |   24 ++++++++++++++++++++++++
 include/linux/fs.h |   11 +++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 2a54c80..68b1784 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1876,6 +1876,30 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 EXPORT_SYMBOL(flock_lock_inode_wait);
 
 /**
+ * locks_lock_inode_wait - Apply a lock to an inode
+ * @inode: inode of the file to apply to
+ * @fl: The lock to be applied
+ *
+ * Apply a POSIX or FLOCK style lock request to an inode.
+ */
+int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+{
+	int res = 0;
+	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
+		case FL_POSIX:
+			res = posix_lock_inode_wait(inode, fl);
+			break;
+		case FL_FLOCK:
+			res = flock_lock_inode_wait(inode, fl);
+			break;
+		default:
+			BUG();
+	}
+	return res;
+}
+EXPORT_SYMBOL(locks_lock_inode_wait);
+
+/**
  *	sys_flock: - flock() system call.
  *	@fd: the file descriptor to lock.
  *	@cmd: the type of lock to apply.
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 72d8a84..2e283b7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1059,6 +1059,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
 extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
 extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
 extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
+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);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
 extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
@@ -1177,6 +1178,11 @@ static inline int flock_lock_inode_wait(struct inode *inode,
 	return -ENOLCK;
 }
 
+static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
+{
+	return -ENOLCK;
+}
+
 static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
 {
 	return 0;
@@ -1225,6 +1231,11 @@ static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
 	return flock_lock_inode_wait(file_inode(filp), fl);
 }
 
+static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
+{
+	return locks_lock_inode_wait(file_inode(filp), fl);
+}
+
 struct fasync_struct {
 	spinlock_t		fa_lock;
 	int			magic;
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 2/3] Move locks API users to locks_lock_inode_wait()
  2015-10-22 15:35 ` Benjamin Coddington
                     ` (2 preceding siblings ...)
  (?)
@ 2015-10-22 15:35   ` Benjamin Coddington
  -1 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Latchesar Ionkov, linux-fsdevel, Trond Myklebust, devel,
	Yan Zheng, cluster-devel, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel, Christine Caulfield,
	v9fs-developer, Ilya Dryomov, linux-cifs, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel, Abdul Hussain, Steven Whitehouse,
	linux-nfs, Andreas Dilger, Greg

Instead of having users check for FL_POSIX or FL_FLOCK to call the correct
locks API function, use the check within locks_lock_inode_wait().  This
allows for some later cleanup.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 drivers/staging/lustre/lustre/llite/file.c |    8 ++------
 fs/9p/vfs_file.c                           |    4 ++--
 fs/ceph/locks.c                            |    4 ++--
 fs/cifs/file.c                             |    2 +-
 fs/dlm/plock.c                             |    4 ++--
 fs/fuse/file.c                             |    2 +-
 fs/gfs2/file.c                             |    8 ++++----
 fs/lockd/clntproc.c                        |   13 +------------
 fs/locks.c                                 |    2 +-
 fs/nfs/file.c                              |   13 +------------
 fs/nfs/nfs4proc.c                          |   13 +------------
 fs/ocfs2/locks.c                           |    8 ++++----
 12 files changed, 22 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index dcd0c6d..4edbf46 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2763,13 +2763,9 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
 	rc = md_enqueue(sbi->ll_md_exp, &einfo, NULL,
 			op_data, &lockh, &flock, 0, NULL /* req */, flags);
 
-	if ((file_lock->fl_flags & FL_FLOCK) &&
-	    (rc == 0 || file_lock->fl_type == F_UNLCK))
-		rc2  = flock_lock_file_wait(file, file_lock);
-	if ((file_lock->fl_flags & FL_POSIX) &&
-	    (rc == 0 || file_lock->fl_type == F_UNLCK) &&
+	if ((rc == 0 || file_lock->fl_type == F_UNLCK) &&
 	    !(flags & LDLM_FL_TEST_LOCK))
-		rc2  = posix_lock_file_wait(file, file_lock);
+		rc2  = locks_lock_file_wait(file, file_lock);
 
 	if (rc2 && file_lock->fl_type != F_UNLCK) {
 		einfo.ei_mode = LCK_NL;
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 3abc447..f23fd86 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -161,7 +161,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
 	if ((fl->fl_flags & FL_POSIX) != FL_POSIX)
 		BUG();
 
-	res = posix_lock_file_wait(filp, fl);
+	res = locks_lock_file_wait(filp, fl);
 	if (res < 0)
 		goto out;
 
@@ -231,7 +231,7 @@ out_unlock:
 	if (res < 0 && fl->fl_type != F_UNLCK) {
 		fl_type = fl->fl_type;
 		fl->fl_type = F_UNLCK;
-		res = posix_lock_file_wait(filp, fl);
+		res = locks_lock_file_wait(filp, fl);
 		fl->fl_type = fl_type;
 	}
 out:
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c
index 6706bde..a2cb0c2 100644
--- a/fs/ceph/locks.c
+++ b/fs/ceph/locks.c
@@ -228,12 +228,12 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
 	err = ceph_lock_message(CEPH_LOCK_FLOCK, CEPH_MDS_OP_SETFILELOCK,
 				file, lock_cmd, wait, fl);
 	if (!err) {
-		err = flock_lock_file_wait(file, fl);
+		err = locks_lock_file_wait(file, fl);
 		if (err) {
 			ceph_lock_message(CEPH_LOCK_FLOCK,
 					  CEPH_MDS_OP_SETFILELOCK,
 					  file, CEPH_LOCK_UNLOCK, 0, fl);
-			dout("got %d on flock_lock_file_wait, undid lock", err);
+			dout("got %d on locks_lock_file_wait, undid lock", err);
 		}
 	}
 	return err;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e2a6af1..6afdad7 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1553,7 +1553,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
 
 out:
 	if (flock->fl_flags & FL_POSIX && !rc)
-		rc = posix_lock_file_wait(file, flock);
+		rc = locks_lock_file_wait(file, flock);
 	return rc;
 }
 
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index 5532f09..3585cc0 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -172,7 +172,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
 	rv = op->info.rv;
 
 	if (!rv) {
-		if (posix_lock_file_wait(file, fl) < 0)
+		if (locks_lock_file_wait(file, fl) < 0)
 			log_error(ls, "dlm_posix_lock: vfs lock error %llx",
 				  (unsigned long long)number);
 	}
@@ -262,7 +262,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
 	/* cause the vfs unlock to return ENOENT if lock is not found */
 	fl->fl_flags |= FL_EXISTS;
 
-	rv = posix_lock_file_wait(file, fl);
+	rv = locks_lock_file_wait(file, fl);
 	if (rv == -ENOENT) {
 		rv = 0;
 		goto out_free;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index f523f2f..e0faf8f 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2189,7 +2189,7 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)
 	int err;
 
 	if (fc->no_flock) {
-		err = flock_lock_file_wait(file, fl);
+		err = locks_lock_file_wait(file, fl);
 	} else {
 		struct fuse_file *ff = file->private_data;
 
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index cf4ab89..9287a2d 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -1000,7 +1000,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
 	}
 	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
 		if (fl->fl_type == F_UNLCK)
-			posix_lock_file_wait(file, fl);
+			locks_lock_file_wait(file, fl);
 		return -EIO;
 	}
 	if (IS_GETLK(cmd))
@@ -1031,7 +1031,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 	if (gl) {
 		if (fl_gh->gh_state == state)
 			goto out;
-		flock_lock_file_wait(file,
+		locks_lock_file_wait(file,
 				     &(struct file_lock){.fl_type = F_UNLCK});
 		gfs2_glock_dq(fl_gh);
 		gfs2_holder_reinit(state, flags, fl_gh);
@@ -1056,7 +1056,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 		if (error == GLR_TRYFAILED)
 			error = -EAGAIN;
 	} else {
-		error = flock_lock_file_wait(file, fl);
+		error = locks_lock_file_wait(file, fl);
 		gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error);
 	}
 
@@ -1071,7 +1071,7 @@ static void do_unflock(struct file *file, struct file_lock *fl)
 	struct gfs2_holder *fl_gh = &fp->f_fl_gh;
 
 	mutex_lock(&fp->f_fl_mutex);
-	flock_lock_file_wait(file, fl);
+	locks_lock_file_wait(file, fl);
 	if (fl_gh->gh_gl) {
 		gfs2_glock_dq(fl_gh);
 		gfs2_holder_uninit(fl_gh);
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index acd3947..1129520 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -474,18 +474,7 @@ static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *ho
 
 static int do_vfs_lock(struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_file_wait(fl->fl_file, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_file_wait(fl->fl_file, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_file_wait(fl->fl_file, fl);
 }
 
 /*
diff --git a/fs/locks.c b/fs/locks.c
index 68b1784..94d50d3 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1955,7 +1955,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
 					  (can_sleep) ? F_SETLKW : F_SETLK,
 					  lock);
 	else
-		error = flock_lock_file_wait(f.file, lock);
+		error = locks_lock_file_wait(f.file, lock);
 
  out_free:
 	locks_free_lock(lock);
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index c0f9b1e..37f639d 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -738,18 +738,7 @@ out_noconflict:
 
 static int do_vfs_lock(struct file *file, struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_file_wait(file, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_file_wait(file, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_file_wait(file, fl);
 }
 
 static int
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5133bb1..0e5ff69 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5513,18 +5513,7 @@ static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *
 
 static int do_vfs_lock(struct inode *inode, struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_inode_wait(inode, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_inode_wait(inode, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_inode_wait(inode, fl);
 }
 
 struct nfs4_unlockdata {
diff --git a/fs/ocfs2/locks.c b/fs/ocfs2/locks.c
index 6b6d092..652ece4 100644
--- a/fs/ocfs2/locks.c
+++ b/fs/ocfs2/locks.c
@@ -66,7 +66,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
 		 * level.
 		 */
 
-		flock_lock_file_wait(file,
+		locks_lock_file_wait(file,
 				     &(struct file_lock){.fl_type = F_UNLCK});
 
 		ocfs2_file_unlock(file);
@@ -81,7 +81,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
 		goto out;
 	}
 
-	ret = flock_lock_file_wait(file, fl);
+	ret = locks_lock_file_wait(file, fl);
 	if (ret)
 		ocfs2_file_unlock(file);
 
@@ -98,7 +98,7 @@ static int ocfs2_do_funlock(struct file *file, int cmd, struct file_lock *fl)
 
 	mutex_lock(&fp->fp_mutex);
 	ocfs2_file_unlock(file);
-	ret = flock_lock_file_wait(file, fl);
+	ret = locks_lock_file_wait(file, fl);
 	mutex_unlock(&fp->fp_mutex);
 
 	return ret;
@@ -119,7 +119,7 @@ int ocfs2_flock(struct file *file, int cmd, struct file_lock *fl)
 
 	if ((osb->s_mount_opt & OCFS2_MOUNT_LOCALFLOCKS) ||
 	    ocfs2_mount_local(osb))
-		return flock_lock_file_wait(file, fl);
+		return locks_lock_file_wait(file, fl);
 
 	if (fl->fl_type == F_UNLCK)
 		return ocfs2_do_funlock(file, cmd, fl);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 2/3] Move locks API users to locks_lock_inode_wait()
@ 2015-10-22 15:35   ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Christoph Hellwig, Oleg Drokin, Andreas Dilger,
	Greg Kroah-Hartman, Eric Van Hensbergen, Ron Minnich,
	Latchesar Ionkov, Yan Zheng, Sage Weil, Ilya Dryomov,
	Steve French, Christine Caulfield, David Teigland,
	Miklos Szeredi, Steven Whitehouse, Bob Peterson, Trond Myklebust,
	Anna Schumaker, Mark Fasheh, Joel Becker, aybuke ozdemir,
	Julia Lawall, Abdul Hussain, lustre-devel, devel, linux-kernel,
	v9fs-developer, ceph-devel, linux-cifs, samba-technical,
	cluster-devel, fuse-devel, linux-nfs, linux-fsdevel, ocfs2-devel

Instead of having users check for FL_POSIX or FL_FLOCK to call the correct
locks API function, use the check within locks_lock_inode_wait().  This
allows for some later cleanup.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 drivers/staging/lustre/lustre/llite/file.c |    8 ++------
 fs/9p/vfs_file.c                           |    4 ++--
 fs/ceph/locks.c                            |    4 ++--
 fs/cifs/file.c                             |    2 +-
 fs/dlm/plock.c                             |    4 ++--
 fs/fuse/file.c                             |    2 +-
 fs/gfs2/file.c                             |    8 ++++----
 fs/lockd/clntproc.c                        |   13 +------------
 fs/locks.c                                 |    2 +-
 fs/nfs/file.c                              |   13 +------------
 fs/nfs/nfs4proc.c                          |   13 +------------
 fs/ocfs2/locks.c                           |    8 ++++----
 12 files changed, 22 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index dcd0c6d..4edbf46 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2763,13 +2763,9 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
 	rc = md_enqueue(sbi->ll_md_exp, &einfo, NULL,
 			op_data, &lockh, &flock, 0, NULL /* req */, flags);
 
-	if ((file_lock->fl_flags & FL_FLOCK) &&
-	    (rc == 0 || file_lock->fl_type == F_UNLCK))
-		rc2  = flock_lock_file_wait(file, file_lock);
-	if ((file_lock->fl_flags & FL_POSIX) &&
-	    (rc == 0 || file_lock->fl_type == F_UNLCK) &&
+	if ((rc == 0 || file_lock->fl_type == F_UNLCK) &&
 	    !(flags & LDLM_FL_TEST_LOCK))
-		rc2  = posix_lock_file_wait(file, file_lock);
+		rc2  = locks_lock_file_wait(file, file_lock);
 
 	if (rc2 && file_lock->fl_type != F_UNLCK) {
 		einfo.ei_mode = LCK_NL;
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 3abc447..f23fd86 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -161,7 +161,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
 	if ((fl->fl_flags & FL_POSIX) != FL_POSIX)
 		BUG();
 
-	res = posix_lock_file_wait(filp, fl);
+	res = locks_lock_file_wait(filp, fl);
 	if (res < 0)
 		goto out;
 
@@ -231,7 +231,7 @@ out_unlock:
 	if (res < 0 && fl->fl_type != F_UNLCK) {
 		fl_type = fl->fl_type;
 		fl->fl_type = F_UNLCK;
-		res = posix_lock_file_wait(filp, fl);
+		res = locks_lock_file_wait(filp, fl);
 		fl->fl_type = fl_type;
 	}
 out:
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c
index 6706bde..a2cb0c2 100644
--- a/fs/ceph/locks.c
+++ b/fs/ceph/locks.c
@@ -228,12 +228,12 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
 	err = ceph_lock_message(CEPH_LOCK_FLOCK, CEPH_MDS_OP_SETFILELOCK,
 				file, lock_cmd, wait, fl);
 	if (!err) {
-		err = flock_lock_file_wait(file, fl);
+		err = locks_lock_file_wait(file, fl);
 		if (err) {
 			ceph_lock_message(CEPH_LOCK_FLOCK,
 					  CEPH_MDS_OP_SETFILELOCK,
 					  file, CEPH_LOCK_UNLOCK, 0, fl);
-			dout("got %d on flock_lock_file_wait, undid lock", err);
+			dout("got %d on locks_lock_file_wait, undid lock", err);
 		}
 	}
 	return err;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e2a6af1..6afdad7 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1553,7 +1553,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
 
 out:
 	if (flock->fl_flags & FL_POSIX && !rc)
-		rc = posix_lock_file_wait(file, flock);
+		rc = locks_lock_file_wait(file, flock);
 	return rc;
 }
 
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index 5532f09..3585cc0 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -172,7 +172,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
 	rv = op->info.rv;
 
 	if (!rv) {
-		if (posix_lock_file_wait(file, fl) < 0)
+		if (locks_lock_file_wait(file, fl) < 0)
 			log_error(ls, "dlm_posix_lock: vfs lock error %llx",
 				  (unsigned long long)number);
 	}
@@ -262,7 +262,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
 	/* cause the vfs unlock to return ENOENT if lock is not found */
 	fl->fl_flags |= FL_EXISTS;
 
-	rv = posix_lock_file_wait(file, fl);
+	rv = locks_lock_file_wait(file, fl);
 	if (rv == -ENOENT) {
 		rv = 0;
 		goto out_free;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index f523f2f..e0faf8f 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2189,7 +2189,7 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)
 	int err;
 
 	if (fc->no_flock) {
-		err = flock_lock_file_wait(file, fl);
+		err = locks_lock_file_wait(file, fl);
 	} else {
 		struct fuse_file *ff = file->private_data;
 
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index cf4ab89..9287a2d 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -1000,7 +1000,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
 	}
 	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
 		if (fl->fl_type == F_UNLCK)
-			posix_lock_file_wait(file, fl);
+			locks_lock_file_wait(file, fl);
 		return -EIO;
 	}
 	if (IS_GETLK(cmd))
@@ -1031,7 +1031,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 	if (gl) {
 		if (fl_gh->gh_state == state)
 			goto out;
-		flock_lock_file_wait(file,
+		locks_lock_file_wait(file,
 				     &(struct file_lock){.fl_type = F_UNLCK});
 		gfs2_glock_dq(fl_gh);
 		gfs2_holder_reinit(state, flags, fl_gh);
@@ -1056,7 +1056,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 		if (error == GLR_TRYFAILED)
 			error = -EAGAIN;
 	} else {
-		error = flock_lock_file_wait(file, fl);
+		error = locks_lock_file_wait(file, fl);
 		gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error);
 	}
 
@@ -1071,7 +1071,7 @@ static void do_unflock(struct file *file, struct file_lock *fl)
 	struct gfs2_holder *fl_gh = &fp->f_fl_gh;
 
 	mutex_lock(&fp->f_fl_mutex);
-	flock_lock_file_wait(file, fl);
+	locks_lock_file_wait(file, fl);
 	if (fl_gh->gh_gl) {
 		gfs2_glock_dq(fl_gh);
 		gfs2_holder_uninit(fl_gh);
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index acd3947..1129520 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -474,18 +474,7 @@ static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *ho
 
 static int do_vfs_lock(struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_file_wait(fl->fl_file, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_file_wait(fl->fl_file, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_file_wait(fl->fl_file, fl);
 }
 
 /*
diff --git a/fs/locks.c b/fs/locks.c
index 68b1784..94d50d3 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1955,7 +1955,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
 					  (can_sleep) ? F_SETLKW : F_SETLK,
 					  lock);
 	else
-		error = flock_lock_file_wait(f.file, lock);
+		error = locks_lock_file_wait(f.file, lock);
 
  out_free:
 	locks_free_lock(lock);
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index c0f9b1e..37f639d 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -738,18 +738,7 @@ out_noconflict:
 
 static int do_vfs_lock(struct file *file, struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_file_wait(file, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_file_wait(file, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_file_wait(file, fl);
 }
 
 static int
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5133bb1..0e5ff69 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5513,18 +5513,7 @@ static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *
 
 static int do_vfs_lock(struct inode *inode, struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_inode_wait(inode, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_inode_wait(inode, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_inode_wait(inode, fl);
 }
 
 struct nfs4_unlockdata {
diff --git a/fs/ocfs2/locks.c b/fs/ocfs2/locks.c
index 6b6d092..652ece4 100644
--- a/fs/ocfs2/locks.c
+++ b/fs/ocfs2/locks.c
@@ -66,7 +66,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
 		 * level.
 		 */
 
-		flock_lock_file_wait(file,
+		locks_lock_file_wait(file,
 				     &(struct file_lock){.fl_type = F_UNLCK});
 
 		ocfs2_file_unlock(file);
@@ -81,7 +81,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
 		goto out;
 	}
 
-	ret = flock_lock_file_wait(file, fl);
+	ret = locks_lock_file_wait(file, fl);
 	if (ret)
 		ocfs2_file_unlock(file);
 
@@ -98,7 +98,7 @@ static int ocfs2_do_funlock(struct file *file, int cmd, struct file_lock *fl)
 
 	mutex_lock(&fp->fp_mutex);
 	ocfs2_file_unlock(file);
-	ret = flock_lock_file_wait(file, fl);
+	ret = locks_lock_file_wait(file, fl);
 	mutex_unlock(&fp->fp_mutex);
 
 	return ret;
@@ -119,7 +119,7 @@ int ocfs2_flock(struct file *file, int cmd, struct file_lock *fl)
 
 	if ((osb->s_mount_opt & OCFS2_MOUNT_LOCALFLOCKS) ||
 	    ocfs2_mount_local(osb))
-		return flock_lock_file_wait(file, fl);
+		return locks_lock_file_wait(file, fl);
 
 	if (fl->fl_type == F_UNLCK)
 		return ocfs2_do_funlock(file, cmd, fl);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 2/3] Move locks API users to locks_lock_inode_wait()
@ 2015-10-22 15:35   ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Latchesar Ionkov, linux-fsdevel, Trond Myklebust, devel,
	Yan Zheng, cluster-devel, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel, Christine Caulfield,
	v9fs-developer, Ilya Dryomov, linux-cifs, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel, Abdul Hussain, Steven Whitehouse,
	linux-nfs, Andreas Dilger, Greg

Instead of having users check for FL_POSIX or FL_FLOCK to call the correct
locks API function, use the check within locks_lock_inode_wait().  This
allows for some later cleanup.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 drivers/staging/lustre/lustre/llite/file.c |    8 ++------
 fs/9p/vfs_file.c                           |    4 ++--
 fs/ceph/locks.c                            |    4 ++--
 fs/cifs/file.c                             |    2 +-
 fs/dlm/plock.c                             |    4 ++--
 fs/fuse/file.c                             |    2 +-
 fs/gfs2/file.c                             |    8 ++++----
 fs/lockd/clntproc.c                        |   13 +------------
 fs/locks.c                                 |    2 +-
 fs/nfs/file.c                              |   13 +------------
 fs/nfs/nfs4proc.c                          |   13 +------------
 fs/ocfs2/locks.c                           |    8 ++++----
 12 files changed, 22 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index dcd0c6d..4edbf46 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2763,13 +2763,9 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
 	rc = md_enqueue(sbi->ll_md_exp, &einfo, NULL,
 			op_data, &lockh, &flock, 0, NULL /* req */, flags);
 
-	if ((file_lock->fl_flags & FL_FLOCK) &&
-	    (rc == 0 || file_lock->fl_type == F_UNLCK))
-		rc2  = flock_lock_file_wait(file, file_lock);
-	if ((file_lock->fl_flags & FL_POSIX) &&
-	    (rc == 0 || file_lock->fl_type == F_UNLCK) &&
+	if ((rc == 0 || file_lock->fl_type == F_UNLCK) &&
 	    !(flags & LDLM_FL_TEST_LOCK))
-		rc2  = posix_lock_file_wait(file, file_lock);
+		rc2  = locks_lock_file_wait(file, file_lock);
 
 	if (rc2 && file_lock->fl_type != F_UNLCK) {
 		einfo.ei_mode = LCK_NL;
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 3abc447..f23fd86 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -161,7 +161,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
 	if ((fl->fl_flags & FL_POSIX) != FL_POSIX)
 		BUG();
 
-	res = posix_lock_file_wait(filp, fl);
+	res = locks_lock_file_wait(filp, fl);
 	if (res < 0)
 		goto out;
 
@@ -231,7 +231,7 @@ out_unlock:
 	if (res < 0 && fl->fl_type != F_UNLCK) {
 		fl_type = fl->fl_type;
 		fl->fl_type = F_UNLCK;
-		res = posix_lock_file_wait(filp, fl);
+		res = locks_lock_file_wait(filp, fl);
 		fl->fl_type = fl_type;
 	}
 out:
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c
index 6706bde..a2cb0c2 100644
--- a/fs/ceph/locks.c
+++ b/fs/ceph/locks.c
@@ -228,12 +228,12 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
 	err = ceph_lock_message(CEPH_LOCK_FLOCK, CEPH_MDS_OP_SETFILELOCK,
 				file, lock_cmd, wait, fl);
 	if (!err) {
-		err = flock_lock_file_wait(file, fl);
+		err = locks_lock_file_wait(file, fl);
 		if (err) {
 			ceph_lock_message(CEPH_LOCK_FLOCK,
 					  CEPH_MDS_OP_SETFILELOCK,
 					  file, CEPH_LOCK_UNLOCK, 0, fl);
-			dout("got %d on flock_lock_file_wait, undid lock", err);
+			dout("got %d on locks_lock_file_wait, undid lock", err);
 		}
 	}
 	return err;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e2a6af1..6afdad7 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1553,7 +1553,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
 
 out:
 	if (flock->fl_flags & FL_POSIX && !rc)
-		rc = posix_lock_file_wait(file, flock);
+		rc = locks_lock_file_wait(file, flock);
 	return rc;
 }
 
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index 5532f09..3585cc0 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -172,7 +172,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
 	rv = op->info.rv;
 
 	if (!rv) {
-		if (posix_lock_file_wait(file, fl) < 0)
+		if (locks_lock_file_wait(file, fl) < 0)
 			log_error(ls, "dlm_posix_lock: vfs lock error %llx",
 				  (unsigned long long)number);
 	}
@@ -262,7 +262,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
 	/* cause the vfs unlock to return ENOENT if lock is not found */
 	fl->fl_flags |= FL_EXISTS;
 
-	rv = posix_lock_file_wait(file, fl);
+	rv = locks_lock_file_wait(file, fl);
 	if (rv == -ENOENT) {
 		rv = 0;
 		goto out_free;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index f523f2f..e0faf8f 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2189,7 +2189,7 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)
 	int err;
 
 	if (fc->no_flock) {
-		err = flock_lock_file_wait(file, fl);
+		err = locks_lock_file_wait(file, fl);
 	} else {
 		struct fuse_file *ff = file->private_data;
 
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index cf4ab89..9287a2d 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -1000,7 +1000,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
 	}
 	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
 		if (fl->fl_type == F_UNLCK)
-			posix_lock_file_wait(file, fl);
+			locks_lock_file_wait(file, fl);
 		return -EIO;
 	}
 	if (IS_GETLK(cmd))
@@ -1031,7 +1031,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 	if (gl) {
 		if (fl_gh->gh_state == state)
 			goto out;
-		flock_lock_file_wait(file,
+		locks_lock_file_wait(file,
 				     &(struct file_lock){.fl_type = F_UNLCK});
 		gfs2_glock_dq(fl_gh);
 		gfs2_holder_reinit(state, flags, fl_gh);
@@ -1056,7 +1056,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 		if (error == GLR_TRYFAILED)
 			error = -EAGAIN;
 	} else {
-		error = flock_lock_file_wait(file, fl);
+		error = locks_lock_file_wait(file, fl);
 		gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error);
 	}
 
@@ -1071,7 +1071,7 @@ static void do_unflock(struct file *file, struct file_lock *fl)
 	struct gfs2_holder *fl_gh = &fp->f_fl_gh;
 
 	mutex_lock(&fp->f_fl_mutex);
-	flock_lock_file_wait(file, fl);
+	locks_lock_file_wait(file, fl);
 	if (fl_gh->gh_gl) {
 		gfs2_glock_dq(fl_gh);
 		gfs2_holder_uninit(fl_gh);
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index acd3947..1129520 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -474,18 +474,7 @@ static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *ho
 
 static int do_vfs_lock(struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_file_wait(fl->fl_file, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_file_wait(fl->fl_file, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_file_wait(fl->fl_file, fl);
 }
 
 /*
diff --git a/fs/locks.c b/fs/locks.c
index 68b1784..94d50d3 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1955,7 +1955,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
 					  (can_sleep) ? F_SETLKW : F_SETLK,
 					  lock);
 	else
-		error = flock_lock_file_wait(f.file, lock);
+		error = locks_lock_file_wait(f.file, lock);
 
  out_free:
 	locks_free_lock(lock);
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index c0f9b1e..37f639d 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -738,18 +738,7 @@ out_noconflict:
 
 static int do_vfs_lock(struct file *file, struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_file_wait(file, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_file_wait(file, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_file_wait(file, fl);
 }
 
 static int
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5133bb1..0e5ff69 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5513,18 +5513,7 @@ static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *
 
 static int do_vfs_lock(struct inode *inode, struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_inode_wait(inode, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_inode_wait(inode, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_inode_wait(inode, fl);
 }
 
 struct nfs4_unlockdata {
diff --git a/fs/ocfs2/locks.c b/fs/ocfs2/locks.c
index 6b6d092..652ece4 100644
--- a/fs/ocfs2/locks.c
+++ b/fs/ocfs2/locks.c
@@ -66,7 +66,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
 		 * level.
 		 */
 
-		flock_lock_file_wait(file,
+		locks_lock_file_wait(file,
 				     &(struct file_lock){.fl_type = F_UNLCK});
 
 		ocfs2_file_unlock(file);
@@ -81,7 +81,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
 		goto out;
 	}
 
-	ret = flock_lock_file_wait(file, fl);
+	ret = locks_lock_file_wait(file, fl);
 	if (ret)
 		ocfs2_file_unlock(file);
 
@@ -98,7 +98,7 @@ static int ocfs2_do_funlock(struct file *file, int cmd, struct file_lock *fl)
 
 	mutex_lock(&fp->fp_mutex);
 	ocfs2_file_unlock(file);
-	ret = flock_lock_file_wait(file, fl);
+	ret = locks_lock_file_wait(file, fl);
 	mutex_unlock(&fp->fp_mutex);
 
 	return ret;
@@ -119,7 +119,7 @@ int ocfs2_flock(struct file *file, int cmd, struct file_lock *fl)
 
 	if ((osb->s_mount_opt & OCFS2_MOUNT_LOCALFLOCKS) ||
 	    ocfs2_mount_local(osb))
-		return flock_lock_file_wait(file, fl);
+		return locks_lock_file_wait(file, fl);
 
 	if (fl->fl_type == F_UNLCK)
 		return ocfs2_do_funlock(file, cmd, fl);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [lustre-devel] [PATCH 2/3] Move locks API users to locks_lock_inode_wait()
@ 2015-10-22 15:35   ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: lustre-devel

Instead of having users check for FL_POSIX or FL_FLOCK to call the correct
locks API function, use the check within locks_lock_inode_wait().  This
allows for some later cleanup.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 drivers/staging/lustre/lustre/llite/file.c |    8 ++------
 fs/9p/vfs_file.c                           |    4 ++--
 fs/ceph/locks.c                            |    4 ++--
 fs/cifs/file.c                             |    2 +-
 fs/dlm/plock.c                             |    4 ++--
 fs/fuse/file.c                             |    2 +-
 fs/gfs2/file.c                             |    8 ++++----
 fs/lockd/clntproc.c                        |   13 +------------
 fs/locks.c                                 |    2 +-
 fs/nfs/file.c                              |   13 +------------
 fs/nfs/nfs4proc.c                          |   13 +------------
 fs/ocfs2/locks.c                           |    8 ++++----
 12 files changed, 22 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index dcd0c6d..4edbf46 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2763,13 +2763,9 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
 	rc = md_enqueue(sbi->ll_md_exp, &einfo, NULL,
 			op_data, &lockh, &flock, 0, NULL /* req */, flags);
 
-	if ((file_lock->fl_flags & FL_FLOCK) &&
-	    (rc == 0 || file_lock->fl_type == F_UNLCK))
-		rc2  = flock_lock_file_wait(file, file_lock);
-	if ((file_lock->fl_flags & FL_POSIX) &&
-	    (rc == 0 || file_lock->fl_type == F_UNLCK) &&
+	if ((rc == 0 || file_lock->fl_type == F_UNLCK) &&
 	    !(flags & LDLM_FL_TEST_LOCK))
-		rc2  = posix_lock_file_wait(file, file_lock);
+		rc2  = locks_lock_file_wait(file, file_lock);
 
 	if (rc2 && file_lock->fl_type != F_UNLCK) {
 		einfo.ei_mode = LCK_NL;
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 3abc447..f23fd86 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -161,7 +161,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
 	if ((fl->fl_flags & FL_POSIX) != FL_POSIX)
 		BUG();
 
-	res = posix_lock_file_wait(filp, fl);
+	res = locks_lock_file_wait(filp, fl);
 	if (res < 0)
 		goto out;
 
@@ -231,7 +231,7 @@ out_unlock:
 	if (res < 0 && fl->fl_type != F_UNLCK) {
 		fl_type = fl->fl_type;
 		fl->fl_type = F_UNLCK;
-		res = posix_lock_file_wait(filp, fl);
+		res = locks_lock_file_wait(filp, fl);
 		fl->fl_type = fl_type;
 	}
 out:
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c
index 6706bde..a2cb0c2 100644
--- a/fs/ceph/locks.c
+++ b/fs/ceph/locks.c
@@ -228,12 +228,12 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
 	err = ceph_lock_message(CEPH_LOCK_FLOCK, CEPH_MDS_OP_SETFILELOCK,
 				file, lock_cmd, wait, fl);
 	if (!err) {
-		err = flock_lock_file_wait(file, fl);
+		err = locks_lock_file_wait(file, fl);
 		if (err) {
 			ceph_lock_message(CEPH_LOCK_FLOCK,
 					  CEPH_MDS_OP_SETFILELOCK,
 					  file, CEPH_LOCK_UNLOCK, 0, fl);
-			dout("got %d on flock_lock_file_wait, undid lock", err);
+			dout("got %d on locks_lock_file_wait, undid lock", err);
 		}
 	}
 	return err;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e2a6af1..6afdad7 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1553,7 +1553,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
 
 out:
 	if (flock->fl_flags & FL_POSIX && !rc)
-		rc = posix_lock_file_wait(file, flock);
+		rc = locks_lock_file_wait(file, flock);
 	return rc;
 }
 
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index 5532f09..3585cc0 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -172,7 +172,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
 	rv = op->info.rv;
 
 	if (!rv) {
-		if (posix_lock_file_wait(file, fl) < 0)
+		if (locks_lock_file_wait(file, fl) < 0)
 			log_error(ls, "dlm_posix_lock: vfs lock error %llx",
 				  (unsigned long long)number);
 	}
@@ -262,7 +262,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
 	/* cause the vfs unlock to return ENOENT if lock is not found */
 	fl->fl_flags |= FL_EXISTS;
 
-	rv = posix_lock_file_wait(file, fl);
+	rv = locks_lock_file_wait(file, fl);
 	if (rv == -ENOENT) {
 		rv = 0;
 		goto out_free;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index f523f2f..e0faf8f 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2189,7 +2189,7 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)
 	int err;
 
 	if (fc->no_flock) {
-		err = flock_lock_file_wait(file, fl);
+		err = locks_lock_file_wait(file, fl);
 	} else {
 		struct fuse_file *ff = file->private_data;
 
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index cf4ab89..9287a2d 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -1000,7 +1000,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
 	}
 	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
 		if (fl->fl_type == F_UNLCK)
-			posix_lock_file_wait(file, fl);
+			locks_lock_file_wait(file, fl);
 		return -EIO;
 	}
 	if (IS_GETLK(cmd))
@@ -1031,7 +1031,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 	if (gl) {
 		if (fl_gh->gh_state == state)
 			goto out;
-		flock_lock_file_wait(file,
+		locks_lock_file_wait(file,
 				     &(struct file_lock){.fl_type = F_UNLCK});
 		gfs2_glock_dq(fl_gh);
 		gfs2_holder_reinit(state, flags, fl_gh);
@@ -1056,7 +1056,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 		if (error == GLR_TRYFAILED)
 			error = -EAGAIN;
 	} else {
-		error = flock_lock_file_wait(file, fl);
+		error = locks_lock_file_wait(file, fl);
 		gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error);
 	}
 
@@ -1071,7 +1071,7 @@ static void do_unflock(struct file *file, struct file_lock *fl)
 	struct gfs2_holder *fl_gh = &fp->f_fl_gh;
 
 	mutex_lock(&fp->f_fl_mutex);
-	flock_lock_file_wait(file, fl);
+	locks_lock_file_wait(file, fl);
 	if (fl_gh->gh_gl) {
 		gfs2_glock_dq(fl_gh);
 		gfs2_holder_uninit(fl_gh);
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index acd3947..1129520 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -474,18 +474,7 @@ static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *ho
 
 static int do_vfs_lock(struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_file_wait(fl->fl_file, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_file_wait(fl->fl_file, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_file_wait(fl->fl_file, fl);
 }
 
 /*
diff --git a/fs/locks.c b/fs/locks.c
index 68b1784..94d50d3 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1955,7 +1955,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
 					  (can_sleep) ? F_SETLKW : F_SETLK,
 					  lock);
 	else
-		error = flock_lock_file_wait(f.file, lock);
+		error = locks_lock_file_wait(f.file, lock);
 
  out_free:
 	locks_free_lock(lock);
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index c0f9b1e..37f639d 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -738,18 +738,7 @@ out_noconflict:
 
 static int do_vfs_lock(struct file *file, struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_file_wait(file, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_file_wait(file, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_file_wait(file, fl);
 }
 
 static int
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5133bb1..0e5ff69 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5513,18 +5513,7 @@ static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *
 
 static int do_vfs_lock(struct inode *inode, struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_inode_wait(inode, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_inode_wait(inode, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_inode_wait(inode, fl);
 }
 
 struct nfs4_unlockdata {
diff --git a/fs/ocfs2/locks.c b/fs/ocfs2/locks.c
index 6b6d092..652ece4 100644
--- a/fs/ocfs2/locks.c
+++ b/fs/ocfs2/locks.c
@@ -66,7 +66,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
 		 * level.
 		 */
 
-		flock_lock_file_wait(file,
+		locks_lock_file_wait(file,
 				     &(struct file_lock){.fl_type = F_UNLCK});
 
 		ocfs2_file_unlock(file);
@@ -81,7 +81,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
 		goto out;
 	}
 
-	ret = flock_lock_file_wait(file, fl);
+	ret = locks_lock_file_wait(file, fl);
 	if (ret)
 		ocfs2_file_unlock(file);
 
@@ -98,7 +98,7 @@ static int ocfs2_do_funlock(struct file *file, int cmd, struct file_lock *fl)
 
 	mutex_lock(&fp->fp_mutex);
 	ocfs2_file_unlock(file);
-	ret = flock_lock_file_wait(file, fl);
+	ret = locks_lock_file_wait(file, fl);
 	mutex_unlock(&fp->fp_mutex);
 
 	return ret;
@@ -119,7 +119,7 @@ int ocfs2_flock(struct file *file, int cmd, struct file_lock *fl)
 
 	if ((osb->s_mount_opt & OCFS2_MOUNT_LOCALFLOCKS) ||
 	    ocfs2_mount_local(osb))
-		return flock_lock_file_wait(file, fl);
+		return locks_lock_file_wait(file, fl);
 
 	if (fl->fl_type == F_UNLCK)
 		return ocfs2_do_funlock(file, cmd, fl);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [Cluster-devel] [PATCH 2/3] Move locks API users to locks_lock_inode_wait()
@ 2015-10-22 15:35   ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Instead of having users check for FL_POSIX or FL_FLOCK to call the correct
locks API function, use the check within locks_lock_inode_wait().  This
allows for some later cleanup.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 drivers/staging/lustre/lustre/llite/file.c |    8 ++------
 fs/9p/vfs_file.c                           |    4 ++--
 fs/ceph/locks.c                            |    4 ++--
 fs/cifs/file.c                             |    2 +-
 fs/dlm/plock.c                             |    4 ++--
 fs/fuse/file.c                             |    2 +-
 fs/gfs2/file.c                             |    8 ++++----
 fs/lockd/clntproc.c                        |   13 +------------
 fs/locks.c                                 |    2 +-
 fs/nfs/file.c                              |   13 +------------
 fs/nfs/nfs4proc.c                          |   13 +------------
 fs/ocfs2/locks.c                           |    8 ++++----
 12 files changed, 22 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index dcd0c6d..4edbf46 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -2763,13 +2763,9 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
 	rc = md_enqueue(sbi->ll_md_exp, &einfo, NULL,
 			op_data, &lockh, &flock, 0, NULL /* req */, flags);
 
-	if ((file_lock->fl_flags & FL_FLOCK) &&
-	    (rc == 0 || file_lock->fl_type == F_UNLCK))
-		rc2  = flock_lock_file_wait(file, file_lock);
-	if ((file_lock->fl_flags & FL_POSIX) &&
-	    (rc == 0 || file_lock->fl_type == F_UNLCK) &&
+	if ((rc == 0 || file_lock->fl_type == F_UNLCK) &&
 	    !(flags & LDLM_FL_TEST_LOCK))
-		rc2  = posix_lock_file_wait(file, file_lock);
+		rc2  = locks_lock_file_wait(file, file_lock);
 
 	if (rc2 && file_lock->fl_type != F_UNLCK) {
 		einfo.ei_mode = LCK_NL;
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 3abc447..f23fd86 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -161,7 +161,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
 	if ((fl->fl_flags & FL_POSIX) != FL_POSIX)
 		BUG();
 
-	res = posix_lock_file_wait(filp, fl);
+	res = locks_lock_file_wait(filp, fl);
 	if (res < 0)
 		goto out;
 
@@ -231,7 +231,7 @@ out_unlock:
 	if (res < 0 && fl->fl_type != F_UNLCK) {
 		fl_type = fl->fl_type;
 		fl->fl_type = F_UNLCK;
-		res = posix_lock_file_wait(filp, fl);
+		res = locks_lock_file_wait(filp, fl);
 		fl->fl_type = fl_type;
 	}
 out:
diff --git a/fs/ceph/locks.c b/fs/ceph/locks.c
index 6706bde..a2cb0c2 100644
--- a/fs/ceph/locks.c
+++ b/fs/ceph/locks.c
@@ -228,12 +228,12 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
 	err = ceph_lock_message(CEPH_LOCK_FLOCK, CEPH_MDS_OP_SETFILELOCK,
 				file, lock_cmd, wait, fl);
 	if (!err) {
-		err = flock_lock_file_wait(file, fl);
+		err = locks_lock_file_wait(file, fl);
 		if (err) {
 			ceph_lock_message(CEPH_LOCK_FLOCK,
 					  CEPH_MDS_OP_SETFILELOCK,
 					  file, CEPH_LOCK_UNLOCK, 0, fl);
-			dout("got %d on flock_lock_file_wait, undid lock", err);
+			dout("got %d on locks_lock_file_wait, undid lock", err);
 		}
 	}
 	return err;
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e2a6af1..6afdad7 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1553,7 +1553,7 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
 
 out:
 	if (flock->fl_flags & FL_POSIX && !rc)
-		rc = posix_lock_file_wait(file, flock);
+		rc = locks_lock_file_wait(file, flock);
 	return rc;
 }
 
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index 5532f09..3585cc0 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -172,7 +172,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
 	rv = op->info.rv;
 
 	if (!rv) {
-		if (posix_lock_file_wait(file, fl) < 0)
+		if (locks_lock_file_wait(file, fl) < 0)
 			log_error(ls, "dlm_posix_lock: vfs lock error %llx",
 				  (unsigned long long)number);
 	}
@@ -262,7 +262,7 @@ int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
 	/* cause the vfs unlock to return ENOENT if lock is not found */
 	fl->fl_flags |= FL_EXISTS;
 
-	rv = posix_lock_file_wait(file, fl);
+	rv = locks_lock_file_wait(file, fl);
 	if (rv == -ENOENT) {
 		rv = 0;
 		goto out_free;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index f523f2f..e0faf8f 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2189,7 +2189,7 @@ static int fuse_file_flock(struct file *file, int cmd, struct file_lock *fl)
 	int err;
 
 	if (fc->no_flock) {
-		err = flock_lock_file_wait(file, fl);
+		err = locks_lock_file_wait(file, fl);
 	} else {
 		struct fuse_file *ff = file->private_data;
 
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index cf4ab89..9287a2d 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -1000,7 +1000,7 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
 	}
 	if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
 		if (fl->fl_type == F_UNLCK)
-			posix_lock_file_wait(file, fl);
+			locks_lock_file_wait(file, fl);
 		return -EIO;
 	}
 	if (IS_GETLK(cmd))
@@ -1031,7 +1031,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 	if (gl) {
 		if (fl_gh->gh_state == state)
 			goto out;
-		flock_lock_file_wait(file,
+		locks_lock_file_wait(file,
 				     &(struct file_lock){.fl_type = F_UNLCK});
 		gfs2_glock_dq(fl_gh);
 		gfs2_holder_reinit(state, flags, fl_gh);
@@ -1056,7 +1056,7 @@ static int do_flock(struct file *file, int cmd, struct file_lock *fl)
 		if (error == GLR_TRYFAILED)
 			error = -EAGAIN;
 	} else {
-		error = flock_lock_file_wait(file, fl);
+		error = locks_lock_file_wait(file, fl);
 		gfs2_assert_warn(GFS2_SB(&ip->i_inode), !error);
 	}
 
@@ -1071,7 +1071,7 @@ static void do_unflock(struct file *file, struct file_lock *fl)
 	struct gfs2_holder *fl_gh = &fp->f_fl_gh;
 
 	mutex_lock(&fp->f_fl_mutex);
-	flock_lock_file_wait(file, fl);
+	locks_lock_file_wait(file, fl);
 	if (fl_gh->gh_gl) {
 		gfs2_glock_dq(fl_gh);
 		gfs2_holder_uninit(fl_gh);
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
index acd3947..1129520 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
@@ -474,18 +474,7 @@ static void nlmclnt_locks_init_private(struct file_lock *fl, struct nlm_host *ho
 
 static int do_vfs_lock(struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_file_wait(fl->fl_file, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_file_wait(fl->fl_file, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_file_wait(fl->fl_file, fl);
 }
 
 /*
diff --git a/fs/locks.c b/fs/locks.c
index 68b1784..94d50d3 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1955,7 +1955,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
 					  (can_sleep) ? F_SETLKW : F_SETLK,
 					  lock);
 	else
-		error = flock_lock_file_wait(f.file, lock);
+		error = locks_lock_file_wait(f.file, lock);
 
  out_free:
 	locks_free_lock(lock);
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index c0f9b1e..37f639d 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -738,18 +738,7 @@ out_noconflict:
 
 static int do_vfs_lock(struct file *file, struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_file_wait(file, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_file_wait(file, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_file_wait(file, fl);
 }
 
 static int
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5133bb1..0e5ff69 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5513,18 +5513,7 @@ static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *
 
 static int do_vfs_lock(struct inode *inode, struct file_lock *fl)
 {
-	int res = 0;
-	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
-		case FL_POSIX:
-			res = posix_lock_inode_wait(inode, fl);
-			break;
-		case FL_FLOCK:
-			res = flock_lock_inode_wait(inode, fl);
-			break;
-		default:
-			BUG();
-	}
-	return res;
+	return locks_lock_inode_wait(inode, fl);
 }
 
 struct nfs4_unlockdata {
diff --git a/fs/ocfs2/locks.c b/fs/ocfs2/locks.c
index 6b6d092..652ece4 100644
--- a/fs/ocfs2/locks.c
+++ b/fs/ocfs2/locks.c
@@ -66,7 +66,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
 		 * level.
 		 */
 
-		flock_lock_file_wait(file,
+		locks_lock_file_wait(file,
 				     &(struct file_lock){.fl_type = F_UNLCK});
 
 		ocfs2_file_unlock(file);
@@ -81,7 +81,7 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
 		goto out;
 	}
 
-	ret = flock_lock_file_wait(file, fl);
+	ret = locks_lock_file_wait(file, fl);
 	if (ret)
 		ocfs2_file_unlock(file);
 
@@ -98,7 +98,7 @@ static int ocfs2_do_funlock(struct file *file, int cmd, struct file_lock *fl)
 
 	mutex_lock(&fp->fp_mutex);
 	ocfs2_file_unlock(file);
-	ret = flock_lock_file_wait(file, fl);
+	ret = locks_lock_file_wait(file, fl);
 	mutex_unlock(&fp->fp_mutex);
 
 	return ret;
@@ -119,7 +119,7 @@ int ocfs2_flock(struct file *file, int cmd, struct file_lock *fl)
 
 	if ((osb->s_mount_opt & OCFS2_MOUNT_LOCALFLOCKS) ||
 	    ocfs2_mount_local(osb))
-		return flock_lock_file_wait(file, fl);
+		return locks_lock_file_wait(file, fl);
 
 	if (fl->fl_type == F_UNLCK)
 		return ocfs2_do_funlock(file, cmd, fl);
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait
  2015-10-22 15:35 ` Benjamin Coddington
                     ` (2 preceding siblings ...)
  (?)
@ 2015-10-22 15:35   ` Benjamin Coddington
  -1 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Latchesar Ionkov, linux-fsdevel, Trond Myklebust, devel,
	Yan Zheng, cluster-devel, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel, Christine Caulfield,
	v9fs-developer, Ilya Dryomov, linux-cifs, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel, Abdul Hussain, Steven Whitehouse,
	linux-nfs, Andreas Dilger, Greg

All callers use locks_lock_inode_wait() instead.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/locks.c         |    5 +----
 include/linux/fs.h |   24 ------------------------
 2 files changed, 1 insertions(+), 28 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 94d50d3..b6f3c92 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1167,8 +1167,7 @@ EXPORT_SYMBOL(posix_lock_file);
  * @inode: inode of file to which lock request should be applied
  * @fl: The lock to be applied
  *
- * Variant of posix_lock_file_wait that does not take a filp, and so can be
- * used after the filp has already been torn down.
+ * Apply a POSIX style lock request to an inode.
  */
 int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
@@ -1187,7 +1186,6 @@ int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 	}
 	return error;
 }
-EXPORT_SYMBOL(posix_lock_inode_wait);
 
 /**
  * locks_mandatory_locked - Check for an active lock
@@ -1873,7 +1871,6 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 	}
 	return error;
 }
-EXPORT_SYMBOL(flock_lock_inode_wait);
 
 /**
  * locks_lock_inode_wait - Apply a lock to an inode
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2e283b7..05b07c9 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1053,12 +1053,10 @@ extern void locks_remove_file(struct file *);
 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 posix_lock_inode_wait(struct inode *, struct file_lock *);
 extern int posix_unblock_lock(struct file_lock *);
 extern int vfs_test_lock(struct file *, struct file_lock *);
 extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
 extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
-extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
 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);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
@@ -1145,12 +1143,6 @@ static inline int posix_lock_file(struct file *filp, struct file_lock *fl,
 	return -ENOLCK;
 }
 
-static inline int posix_lock_inode_wait(struct inode *inode,
-					struct file_lock *fl)
-{
-	return -ENOLCK;
-}
-
 static inline int posix_unblock_lock(struct file_lock *waiter)
 {
 	return -ENOENT;
@@ -1172,12 +1164,6 @@ static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
 	return 0;
 }
 
-static inline int flock_lock_inode_wait(struct inode *inode,
-					struct file_lock *request)
-{
-	return -ENOLCK;
-}
-
 static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
 {
 	return -ENOLCK;
@@ -1221,16 +1207,6 @@ static inline struct inode *file_inode(const struct file *f)
 	return f->f_inode;
 }
 
-static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
-{
-	return posix_lock_inode_wait(file_inode(filp), fl);
-}
-
-static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
-{
-	return flock_lock_inode_wait(file_inode(filp), fl);
-}
-
 static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
 {
 	return locks_lock_inode_wait(file_inode(filp), fl);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait
@ 2015-10-22 15:35   ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Christoph Hellwig, Oleg Drokin, Andreas Dilger,
	Greg Kroah-Hartman, Eric Van Hensbergen, Ron Minnich,
	Latchesar Ionkov, Yan Zheng, Sage Weil, Ilya Dryomov,
	Steve French, Christine Caulfield, David Teigland,
	Miklos Szeredi, Steven Whitehouse, Bob Peterson, Trond Myklebust,
	Anna Schumaker, Mark Fasheh, Joel Becker, aybuke ozdemir,
	Julia Lawall, Abdul Hussain, lustre-devel, devel, linux-kernel,
	v9fs-developer, ceph-devel, linux-cifs, samba-technical,
	cluster-devel, fuse-devel, linux-nfs, linux-fsdevel, ocfs2-devel

All callers use locks_lock_inode_wait() instead.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/locks.c         |    5 +----
 include/linux/fs.h |   24 ------------------------
 2 files changed, 1 insertions(+), 28 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 94d50d3..b6f3c92 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1167,8 +1167,7 @@ EXPORT_SYMBOL(posix_lock_file);
  * @inode: inode of file to which lock request should be applied
  * @fl: The lock to be applied
  *
- * Variant of posix_lock_file_wait that does not take a filp, and so can be
- * used after the filp has already been torn down.
+ * Apply a POSIX style lock request to an inode.
  */
 int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
@@ -1187,7 +1186,6 @@ int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 	}
 	return error;
 }
-EXPORT_SYMBOL(posix_lock_inode_wait);
 
 /**
  * locks_mandatory_locked - Check for an active lock
@@ -1873,7 +1871,6 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 	}
 	return error;
 }
-EXPORT_SYMBOL(flock_lock_inode_wait);
 
 /**
  * locks_lock_inode_wait - Apply a lock to an inode
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2e283b7..05b07c9 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1053,12 +1053,10 @@ extern void locks_remove_file(struct file *);
 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 posix_lock_inode_wait(struct inode *, struct file_lock *);
 extern int posix_unblock_lock(struct file_lock *);
 extern int vfs_test_lock(struct file *, struct file_lock *);
 extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
 extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
-extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
 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);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
@@ -1145,12 +1143,6 @@ static inline int posix_lock_file(struct file *filp, struct file_lock *fl,
 	return -ENOLCK;
 }
 
-static inline int posix_lock_inode_wait(struct inode *inode,
-					struct file_lock *fl)
-{
-	return -ENOLCK;
-}
-
 static inline int posix_unblock_lock(struct file_lock *waiter)
 {
 	return -ENOENT;
@@ -1172,12 +1164,6 @@ static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
 	return 0;
 }
 
-static inline int flock_lock_inode_wait(struct inode *inode,
-					struct file_lock *request)
-{
-	return -ENOLCK;
-}
-
 static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
 {
 	return -ENOLCK;
@@ -1221,16 +1207,6 @@ static inline struct inode *file_inode(const struct file *f)
 	return f->f_inode;
 }
 
-static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
-{
-	return posix_lock_inode_wait(file_inode(filp), fl);
-}
-
-static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
-{
-	return flock_lock_inode_wait(file_inode(filp), fl);
-}
-
 static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
 {
 	return locks_lock_inode_wait(file_inode(filp), fl);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait
@ 2015-10-22 15:35   ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Latchesar Ionkov, linux-fsdevel, Trond Myklebust, devel,
	Yan Zheng, cluster-devel, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel, Christine Caulfield,
	v9fs-developer, Ilya Dryomov, linux-cifs, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel, Abdul Hussain, Steven Whitehouse,
	linux-nfs, Andreas Dilger, Greg

All callers use locks_lock_inode_wait() instead.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/locks.c         |    5 +----
 include/linux/fs.h |   24 ------------------------
 2 files changed, 1 insertions(+), 28 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 94d50d3..b6f3c92 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1167,8 +1167,7 @@ EXPORT_SYMBOL(posix_lock_file);
  * @inode: inode of file to which lock request should be applied
  * @fl: The lock to be applied
  *
- * Variant of posix_lock_file_wait that does not take a filp, and so can be
- * used after the filp has already been torn down.
+ * Apply a POSIX style lock request to an inode.
  */
 int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
@@ -1187,7 +1186,6 @@ int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 	}
 	return error;
 }
-EXPORT_SYMBOL(posix_lock_inode_wait);
 
 /**
  * locks_mandatory_locked - Check for an active lock
@@ -1873,7 +1871,6 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 	}
 	return error;
 }
-EXPORT_SYMBOL(flock_lock_inode_wait);
 
 /**
  * locks_lock_inode_wait - Apply a lock to an inode
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2e283b7..05b07c9 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1053,12 +1053,10 @@ extern void locks_remove_file(struct file *);
 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 posix_lock_inode_wait(struct inode *, struct file_lock *);
 extern int posix_unblock_lock(struct file_lock *);
 extern int vfs_test_lock(struct file *, struct file_lock *);
 extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
 extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
-extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
 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);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
@@ -1145,12 +1143,6 @@ static inline int posix_lock_file(struct file *filp, struct file_lock *fl,
 	return -ENOLCK;
 }
 
-static inline int posix_lock_inode_wait(struct inode *inode,
-					struct file_lock *fl)
-{
-	return -ENOLCK;
-}
-
 static inline int posix_unblock_lock(struct file_lock *waiter)
 {
 	return -ENOENT;
@@ -1172,12 +1164,6 @@ static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
 	return 0;
 }
 
-static inline int flock_lock_inode_wait(struct inode *inode,
-					struct file_lock *request)
-{
-	return -ENOLCK;
-}
-
 static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
 {
 	return -ENOLCK;
@@ -1221,16 +1207,6 @@ static inline struct inode *file_inode(const struct file *f)
 	return f->f_inode;
 }
 
-static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
-{
-	return posix_lock_inode_wait(file_inode(filp), fl);
-}
-
-static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
-{
-	return flock_lock_inode_wait(file_inode(filp), fl);
-}
-
 static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
 {
 	return locks_lock_inode_wait(file_inode(filp), fl);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [lustre-devel] [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait
@ 2015-10-22 15:35   ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: lustre-devel

All callers use locks_lock_inode_wait() instead.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/locks.c         |    5 +----
 include/linux/fs.h |   24 ------------------------
 2 files changed, 1 insertions(+), 28 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 94d50d3..b6f3c92 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1167,8 +1167,7 @@ EXPORT_SYMBOL(posix_lock_file);
  * @inode: inode of file to which lock request should be applied
  * @fl: The lock to be applied
  *
- * Variant of posix_lock_file_wait that does not take a filp, and so can be
- * used after the filp has already been torn down.
+ * Apply a POSIX style lock request to an inode.
  */
 int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
@@ -1187,7 +1186,6 @@ int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 	}
 	return error;
 }
-EXPORT_SYMBOL(posix_lock_inode_wait);
 
 /**
  * locks_mandatory_locked - Check for an active lock
@@ -1873,7 +1871,6 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 	}
 	return error;
 }
-EXPORT_SYMBOL(flock_lock_inode_wait);
 
 /**
  * locks_lock_inode_wait - Apply a lock to an inode
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2e283b7..05b07c9 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1053,12 +1053,10 @@ extern void locks_remove_file(struct file *);
 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 posix_lock_inode_wait(struct inode *, struct file_lock *);
 extern int posix_unblock_lock(struct file_lock *);
 extern int vfs_test_lock(struct file *, struct file_lock *);
 extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
 extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
-extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
 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);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
@@ -1145,12 +1143,6 @@ static inline int posix_lock_file(struct file *filp, struct file_lock *fl,
 	return -ENOLCK;
 }
 
-static inline int posix_lock_inode_wait(struct inode *inode,
-					struct file_lock *fl)
-{
-	return -ENOLCK;
-}
-
 static inline int posix_unblock_lock(struct file_lock *waiter)
 {
 	return -ENOENT;
@@ -1172,12 +1164,6 @@ static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
 	return 0;
 }
 
-static inline int flock_lock_inode_wait(struct inode *inode,
-					struct file_lock *request)
-{
-	return -ENOLCK;
-}
-
 static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
 {
 	return -ENOLCK;
@@ -1221,16 +1207,6 @@ static inline struct inode *file_inode(const struct file *f)
 	return f->f_inode;
 }
 
-static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
-{
-	return posix_lock_inode_wait(file_inode(filp), fl);
-}
-
-static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
-{
-	return flock_lock_inode_wait(file_inode(filp), fl);
-}
-
 static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
 {
 	return locks_lock_inode_wait(file_inode(filp), fl);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [Cluster-devel] [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait
@ 2015-10-22 15:35   ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 15:35 UTC (permalink / raw)
  To: cluster-devel.redhat.com

All callers use locks_lock_inode_wait() instead.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/locks.c         |    5 +----
 include/linux/fs.h |   24 ------------------------
 2 files changed, 1 insertions(+), 28 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 94d50d3..b6f3c92 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1167,8 +1167,7 @@ EXPORT_SYMBOL(posix_lock_file);
  * @inode: inode of file to which lock request should be applied
  * @fl: The lock to be applied
  *
- * Variant of posix_lock_file_wait that does not take a filp, and so can be
- * used after the filp has already been torn down.
+ * Apply a POSIX style lock request to an inode.
  */
 int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
@@ -1187,7 +1186,6 @@ int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 	}
 	return error;
 }
-EXPORT_SYMBOL(posix_lock_inode_wait);
 
 /**
  * locks_mandatory_locked - Check for an active lock
@@ -1873,7 +1871,6 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 	}
 	return error;
 }
-EXPORT_SYMBOL(flock_lock_inode_wait);
 
 /**
  * locks_lock_inode_wait - Apply a lock to an inode
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2e283b7..05b07c9 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1053,12 +1053,10 @@ extern void locks_remove_file(struct file *);
 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 posix_lock_inode_wait(struct inode *, struct file_lock *);
 extern int posix_unblock_lock(struct file_lock *);
 extern int vfs_test_lock(struct file *, struct file_lock *);
 extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
 extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
-extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
 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);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
@@ -1145,12 +1143,6 @@ static inline int posix_lock_file(struct file *filp, struct file_lock *fl,
 	return -ENOLCK;
 }
 
-static inline int posix_lock_inode_wait(struct inode *inode,
-					struct file_lock *fl)
-{
-	return -ENOLCK;
-}
-
 static inline int posix_unblock_lock(struct file_lock *waiter)
 {
 	return -ENOENT;
@@ -1172,12 +1164,6 @@ static inline int vfs_cancel_lock(struct file *filp, struct file_lock *fl)
 	return 0;
 }
 
-static inline int flock_lock_inode_wait(struct inode *inode,
-					struct file_lock *request)
-{
-	return -ENOLCK;
-}
-
 static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
 {
 	return -ENOLCK;
@@ -1221,16 +1207,6 @@ static inline struct inode *file_inode(const struct file *f)
 	return f->f_inode;
 }
 
-static inline int posix_lock_file_wait(struct file *filp, struct file_lock *fl)
-{
-	return posix_lock_inode_wait(file_inode(filp), fl);
-}
-
-static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
-{
-	return flock_lock_inode_wait(file_inode(filp), fl);
-}
-
 static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
 {
 	return locks_lock_inode_wait(file_inode(filp), fl);
-- 
1.7.1



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/3] locks: introduce locks_lock_inode_wait()
  2015-10-22 15:35   ` Benjamin Coddington
  (?)
  (?)
@ 2015-10-22 15:59       ` kbuild test robot
  -1 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 15:59 UTC (permalink / raw)
  To: Benjamin Coddington
  Cc: kbuild-all-JC7UmRfGjtg, Jeff Layton, J. Bruce Fields,
	Alexander Viro, Latchesar Ionkov,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, Trond Myklebust,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, Yan Zheng,
	cluster-devel-H+wXaHxf7aLQT0dZR+AlfA, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Christine Caulfield,
	v9fs-developer-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, Ilya Dryomov,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel-u79uwXL29TY76Z2rM5mHXA, Abdu

[-- Attachment #1: Type: text/plain, Size: 2260 bytes --]

Hi Benjamin,

[auto build test ERROR on jlayton/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Coddington/locks-introduce-locks_lock_inode_wait/20151022-233848
config: x86_64-allnoconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from include/linux/cgroup.h:17:0,
                    from include/linux/memcontrol.h:22,
                    from include/linux/swap.h:8,
                    from include/linux/suspend.h:4,
                    from arch/x86/kernel/asm-offsets.c:12:
>> include/linux/fs.h:1234:19: error: redefinition of 'locks_lock_file_wait'
    static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
                      ^
   include/linux/fs.h:1181:19: note: previous definition of 'locks_lock_file_wait' was here
    static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
                      ^
   include/linux/fs.h: In function 'locks_lock_file_wait':
>> include/linux/fs.h:1236:9: error: implicit declaration of function 'locks_lock_inode_wait' [-Werror=implicit-function-declaration]
     return locks_lock_inode_wait(file_inode(filp), fl);
            ^
   cc1: some warnings being treated as errors
   make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +/locks_lock_file_wait +1234 include/linux/fs.h

  1228	
  1229	static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
  1230	{
  1231		return flock_lock_inode_wait(file_inode(filp), fl);
  1232	}
  1233	
> 1234	static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
  1235	{
> 1236		return locks_lock_inode_wait(file_inode(filp), fl);
  1237	}
  1238	
  1239	struct fasync_struct {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 6030 bytes --]

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/3] locks: introduce locks_lock_inode_wait()
@ 2015-10-22 15:59       ` kbuild test robot
  0 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 15:59 UTC (permalink / raw)
  To: Benjamin Coddington
  Cc: kbuild-all, Jeff Layton, J. Bruce Fields, Alexander Viro,
	Latchesar Ionkov, linux-fsdevel, Trond Myklebust, devel,
	Yan Zheng, cluster-devel, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel, Christine Caulfield,
	v9fs-developer, Ilya Dryomov, linux-cifs, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel, Abdul Hussain, Steven Whitehouse,
	linux-nfs, Andreas Dilger, Greg Kroah-Hartman, samba-technical,
	linux-kernel, Steve French, Bob Peterson, Ron Minnich,
	Anna Schumaker, ocfs2-devel, lustre-devel

[-- Attachment #1: Type: text/plain, Size: 2260 bytes --]

Hi Benjamin,

[auto build test ERROR on jlayton/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Coddington/locks-introduce-locks_lock_inode_wait/20151022-233848
config: x86_64-allnoconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from include/linux/cgroup.h:17:0,
                    from include/linux/memcontrol.h:22,
                    from include/linux/swap.h:8,
                    from include/linux/suspend.h:4,
                    from arch/x86/kernel/asm-offsets.c:12:
>> include/linux/fs.h:1234:19: error: redefinition of 'locks_lock_file_wait'
    static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
                      ^
   include/linux/fs.h:1181:19: note: previous definition of 'locks_lock_file_wait' was here
    static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
                      ^
   include/linux/fs.h: In function 'locks_lock_file_wait':
>> include/linux/fs.h:1236:9: error: implicit declaration of function 'locks_lock_inode_wait' [-Werror=implicit-function-declaration]
     return locks_lock_inode_wait(file_inode(filp), fl);
            ^
   cc1: some warnings being treated as errors
   make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +/locks_lock_file_wait +1234 include/linux/fs.h

  1228	
  1229	static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
  1230	{
  1231		return flock_lock_inode_wait(file_inode(filp), fl);
  1232	}
  1233	
> 1234	static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
  1235	{
> 1236		return locks_lock_inode_wait(file_inode(filp), fl);
  1237	}
  1238	
  1239	struct fasync_struct {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 6030 bytes --]

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [lustre-devel] [PATCH 1/3] locks: introduce locks_lock_inode_wait()
@ 2015-10-22 15:59       ` kbuild test robot
  0 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 15:59 UTC (permalink / raw)
  To: lustre-devel

Hi Benjamin,

[auto build test ERROR on jlayton/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Coddington/locks-introduce-locks_lock_inode_wait/20151022-233848
config: x86_64-allnoconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from include/linux/cgroup.h:17:0,
                    from include/linux/memcontrol.h:22,
                    from include/linux/swap.h:8,
                    from include/linux/suspend.h:4,
                    from arch/x86/kernel/asm-offsets.c:12:
>> include/linux/fs.h:1234:19: error: redefinition of 'locks_lock_file_wait'
    static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
                      ^
   include/linux/fs.h:1181:19: note: previous definition of 'locks_lock_file_wait' was here
    static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
                      ^
   include/linux/fs.h: In function 'locks_lock_file_wait':
>> include/linux/fs.h:1236:9: error: implicit declaration of function 'locks_lock_inode_wait' [-Werror=implicit-function-declaration]
     return locks_lock_inode_wait(file_inode(filp), fl);
            ^
   cc1: some warnings being treated as errors
   make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +/locks_lock_file_wait +1234 include/linux/fs.h

  1228	
  1229	static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
  1230	{
  1231		return flock_lock_inode_wait(file_inode(filp), fl);
  1232	}
  1233	
> 1234	static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
  1235	{
> 1236		return locks_lock_inode_wait(file_inode(filp), fl);
  1237	}
  1238	
  1239	struct fasync_struct {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 6030 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20151022/dabc38ad/attachment.obj>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Cluster-devel] [PATCH 1/3] locks: introduce locks_lock_inode_wait()
@ 2015-10-22 15:59       ` kbuild test robot
  0 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 15:59 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi Benjamin,

[auto build test ERROR on jlayton/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Coddington/locks-introduce-locks_lock_inode_wait/20151022-233848
config: x86_64-allnoconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   In file included from include/linux/cgroup.h:17:0,
                    from include/linux/memcontrol.h:22,
                    from include/linux/swap.h:8,
                    from include/linux/suspend.h:4,
                    from arch/x86/kernel/asm-offsets.c:12:
>> include/linux/fs.h:1234:19: error: redefinition of 'locks_lock_file_wait'
    static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
                      ^
   include/linux/fs.h:1181:19: note: previous definition of 'locks_lock_file_wait' was here
    static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
                      ^
   include/linux/fs.h: In function 'locks_lock_file_wait':
>> include/linux/fs.h:1236:9: error: implicit declaration of function 'locks_lock_inode_wait' [-Werror=implicit-function-declaration]
     return locks_lock_inode_wait(file_inode(filp), fl);
            ^
   cc1: some warnings being treated as errors
   make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1
   make[2]: Target '__build' not remade because of errors.
   make[1]: *** [prepare0] Error 2
   make[1]: Target 'prepare' not remade because of errors.
   make: *** [sub-make] Error 2

vim +/locks_lock_file_wait +1234 include/linux/fs.h

  1228	
  1229	static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
  1230	{
  1231		return flock_lock_inode_wait(file_inode(filp), fl);
  1232	}
  1233	
> 1234	static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
  1235	{
> 1236		return locks_lock_inode_wait(file_inode(filp), fl);
  1237	}
  1238	
  1239	struct fasync_struct {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 6030 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20151022/dabc38ad/attachment.obj>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/3] locks: introduce locks_lock_inode_wait()
  2015-10-22 15:35   ` Benjamin Coddington
                       ` (2 preceding siblings ...)
  (?)
@ 2015-10-22 16:21     ` Benjamin Coddington
  -1 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 16:21 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Christoph Hellwig, Oleg Drokin, Andreas Dilger,
	Greg Kroah-Hartman, Eric Van Hensbergen, Ron Minnich,
	Latchesar Ionkov, Yan Zheng, Sage Weil, Ilya Dryomov,
	Steve French, Christine Caulfield, David Teigland,
	Miklos Szeredi, Steven Whitehouse, Bob Peterson, Trond Myklebust,
	Anna Schumaker, Mark Fasheh, Joel Becker, aybuke ozdemir,
	Julia Lawall, Abdul Hussain

On Thu, 22 Oct 2015, Benjamin Coddington wrote:

> Users of the locks API commonly call either posix_lock_file_wait() or
> flock_lock_file_wait() depending upon the lock type.  Add a new function
> locks_lock_inode_wait() which will check and call the correct function for
> the type of lock passed in.
>
> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
> ---
>  fs/locks.c         |   24 ++++++++++++++++++++++++
>  include/linux/fs.h |   11 +++++++++++
>  2 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/fs/locks.c b/fs/locks.c
> index 2a54c80..68b1784 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -1876,6 +1876,30 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
>  EXPORT_SYMBOL(flock_lock_inode_wait);
>
>  /**
> + * locks_lock_inode_wait - Apply a lock to an inode
> + * @inode: inode of the file to apply to
> + * @fl: The lock to be applied
> + *
> + * Apply a POSIX or FLOCK style lock request to an inode.
> + */
> +int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)
> +{
> +	int res = 0;
> +	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
> +		case FL_POSIX:
> +			res = posix_lock_inode_wait(inode, fl);
> +			break;
> +		case FL_FLOCK:
> +			res = flock_lock_inode_wait(inode, fl);
> +			break;
> +		default:
> +			BUG();
> +	}
> +	return res;
> +}
> +EXPORT_SYMBOL(locks_lock_inode_wait);
> +
> +/**
>   *	sys_flock: - flock() system call.
>   *	@fd: the file descriptor to lock.
>   *	@cmd: the type of lock to apply.
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 72d8a84..2e283b7 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1059,6 +1059,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
>  extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
>  extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
>  extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
> +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);
>  extern void lease_get_mtime(struct inode *, struct timespec *time);
>  extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
> @@ -1177,6 +1178,11 @@ static inline int flock_lock_inode_wait(struct inode *inode,
>  	return -ENOLCK;
>  }
>
> +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
> +{
> +	return -ENOLCK;
> +}
> +

So, this is obviously wrong - thank you 0-day robot.  Yes, I did build and
test against these patches, but went back and added this after I realized it
should work w/o CONFIG_FILE_LOCKING.  I'll re-send.

Ben

>  static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
>  {
>  	return 0;
> @@ -1225,6 +1231,11 @@ static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
>  	return flock_lock_inode_wait(file_inode(filp), fl);
>  }
>
> +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
> +{
> +	return locks_lock_inode_wait(file_inode(filp), fl);
> +}
> +
>  struct fasync_struct {
>  	spinlock_t		fa_lock;
>  	int			magic;
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/3] locks: introduce locks_lock_inode_wait()
@ 2015-10-22 16:21     ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 16:21 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Christoph Hellwig, Oleg Drokin, Andreas Dilger,
	Greg Kroah-Hartman, Eric Van Hensbergen, Ron Minnich,
	Latchesar Ionkov, Yan Zheng, Sage Weil, Ilya Dryomov,
	Steve French, Christine Caulfield, David Teigland,
	Miklos Szeredi, Steven Whitehouse, Bob Peterson, Trond Myklebust,
	Anna Schumaker, Mark Fasheh, Joel Becker, aybuke ozdemir,
	Julia Lawall, Abdul Hussain, lustre-devel, devel, linux-kernel,
	v9fs-developer, ceph-devel, linux-cifs, samba-technical,
	cluster-devel, fuse-devel, linux-nfs, linux-fsdevel, ocfs2-devel

On Thu, 22 Oct 2015, Benjamin Coddington wrote:

> Users of the locks API commonly call either posix_lock_file_wait() or
> flock_lock_file_wait() depending upon the lock type.  Add a new function
> locks_lock_inode_wait() which will check and call the correct function for
> the type of lock passed in.
>
> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
> ---
>  fs/locks.c         |   24 ++++++++++++++++++++++++
>  include/linux/fs.h |   11 +++++++++++
>  2 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/fs/locks.c b/fs/locks.c
> index 2a54c80..68b1784 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -1876,6 +1876,30 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
>  EXPORT_SYMBOL(flock_lock_inode_wait);
>
>  /**
> + * locks_lock_inode_wait - Apply a lock to an inode
> + * @inode: inode of the file to apply to
> + * @fl: The lock to be applied
> + *
> + * Apply a POSIX or FLOCK style lock request to an inode.
> + */
> +int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)
> +{
> +	int res = 0;
> +	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
> +		case FL_POSIX:
> +			res = posix_lock_inode_wait(inode, fl);
> +			break;
> +		case FL_FLOCK:
> +			res = flock_lock_inode_wait(inode, fl);
> +			break;
> +		default:
> +			BUG();
> +	}
> +	return res;
> +}
> +EXPORT_SYMBOL(locks_lock_inode_wait);
> +
> +/**
>   *	sys_flock: - flock() system call.
>   *	@fd: the file descriptor to lock.
>   *	@cmd: the type of lock to apply.
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 72d8a84..2e283b7 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1059,6 +1059,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
>  extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
>  extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
>  extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
> +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);
>  extern void lease_get_mtime(struct inode *, struct timespec *time);
>  extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
> @@ -1177,6 +1178,11 @@ static inline int flock_lock_inode_wait(struct inode *inode,
>  	return -ENOLCK;
>  }
>
> +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
> +{
> +	return -ENOLCK;
> +}
> +

So, this is obviously wrong - thank you 0-day robot.  Yes, I did build and
test against these patches, but went back and added this after I realized it
should work w/o CONFIG_FILE_LOCKING.  I'll re-send.

Ben

>  static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
>  {
>  	return 0;
> @@ -1225,6 +1231,11 @@ static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
>  	return flock_lock_inode_wait(file_inode(filp), fl);
>  }
>
> +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
> +{
> +	return locks_lock_inode_wait(file_inode(filp), fl);
> +}
> +
>  struct fasync_struct {
>  	spinlock_t		fa_lock;
>  	int			magic;
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/3] locks: introduce locks_lock_inode_wait()
@ 2015-10-22 16:21     ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 16:21 UTC (permalink / raw)
  To: Jeff Layton, J. Bruce Fields, Alexander Viro
  Cc: Christoph Hellwig, Oleg Drokin, Andreas Dilger,
	Greg Kroah-Hartman, Eric Van Hensbergen, Ron Minnich,
	Latchesar Ionkov, Yan Zheng, Sage Weil, Ilya Dryomov,
	Steve French, Christine Caulfield, David Teigland,
	Miklos Szeredi, Steven Whitehouse, Bob Peterson, Trond Myklebust,
	Anna Schumaker, Mark Fasheh, Joel Becker, aybuke ozdemir,
	Julia Lawall, Abdul Hussain

On Thu, 22 Oct 2015, Benjamin Coddington wrote:

> Users of the locks API commonly call either posix_lock_file_wait() or
> flock_lock_file_wait() depending upon the lock type.  Add a new function
> locks_lock_inode_wait() which will check and call the correct function for
> the type of lock passed in.
>
> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
> ---
>  fs/locks.c         |   24 ++++++++++++++++++++++++
>  include/linux/fs.h |   11 +++++++++++
>  2 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/fs/locks.c b/fs/locks.c
> index 2a54c80..68b1784 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -1876,6 +1876,30 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
>  EXPORT_SYMBOL(flock_lock_inode_wait);
>
>  /**
> + * locks_lock_inode_wait - Apply a lock to an inode
> + * @inode: inode of the file to apply to
> + * @fl: The lock to be applied
> + *
> + * Apply a POSIX or FLOCK style lock request to an inode.
> + */
> +int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)
> +{
> +	int res = 0;
> +	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
> +		case FL_POSIX:
> +			res = posix_lock_inode_wait(inode, fl);
> +			break;
> +		case FL_FLOCK:
> +			res = flock_lock_inode_wait(inode, fl);
> +			break;
> +		default:
> +			BUG();
> +	}
> +	return res;
> +}
> +EXPORT_SYMBOL(locks_lock_inode_wait);
> +
> +/**
>   *	sys_flock: - flock() system call.
>   *	@fd: the file descriptor to lock.
>   *	@cmd: the type of lock to apply.
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 72d8a84..2e283b7 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1059,6 +1059,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
>  extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
>  extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
>  extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
> +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);
>  extern void lease_get_mtime(struct inode *, struct timespec *time);
>  extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
> @@ -1177,6 +1178,11 @@ static inline int flock_lock_inode_wait(struct inode *inode,
>  	return -ENOLCK;
>  }
>
> +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
> +{
> +	return -ENOLCK;
> +}
> +

So, this is obviously wrong - thank you 0-day robot.  Yes, I did build and
test against these patches, but went back and added this after I realized it
should work w/o CONFIG_FILE_LOCKING.  I'll re-send.

Ben

>  static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
>  {
>  	return 0;
> @@ -1225,6 +1231,11 @@ static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
>  	return flock_lock_inode_wait(file_inode(filp), fl);
>  }
>
> +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
> +{
> +	return locks_lock_inode_wait(file_inode(filp), fl);
> +}
> +
>  struct fasync_struct {
>  	spinlock_t		fa_lock;
>  	int			magic;
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [lustre-devel] [PATCH 1/3] locks: introduce locks_lock_inode_wait()
@ 2015-10-22 16:21     ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 16:21 UTC (permalink / raw)
  To: lustre-devel

On Thu, 22 Oct 2015, Benjamin Coddington wrote:

> Users of the locks API commonly call either posix_lock_file_wait() or
> flock_lock_file_wait() depending upon the lock type.  Add a new function
> locks_lock_inode_wait() which will check and call the correct function for
> the type of lock passed in.
>
> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
> ---
>  fs/locks.c         |   24 ++++++++++++++++++++++++
>  include/linux/fs.h |   11 +++++++++++
>  2 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/fs/locks.c b/fs/locks.c
> index 2a54c80..68b1784 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -1876,6 +1876,30 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
>  EXPORT_SYMBOL(flock_lock_inode_wait);
>
>  /**
> + * locks_lock_inode_wait - Apply a lock to an inode
> + * @inode: inode of the file to apply to
> + * @fl: The lock to be applied
> + *
> + * Apply a POSIX or FLOCK style lock request to an inode.
> + */
> +int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)
> +{
> +	int res = 0;
> +	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
> +		case FL_POSIX:
> +			res = posix_lock_inode_wait(inode, fl);
> +			break;
> +		case FL_FLOCK:
> +			res = flock_lock_inode_wait(inode, fl);
> +			break;
> +		default:
> +			BUG();
> +	}
> +	return res;
> +}
> +EXPORT_SYMBOL(locks_lock_inode_wait);
> +
> +/**
>   *	sys_flock: - flock() system call.
>   *	@fd: the file descriptor to lock.
>   *	@cmd: the type of lock to apply.
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 72d8a84..2e283b7 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1059,6 +1059,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
>  extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
>  extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
>  extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
> +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);
>  extern void lease_get_mtime(struct inode *, struct timespec *time);
>  extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
> @@ -1177,6 +1178,11 @@ static inline int flock_lock_inode_wait(struct inode *inode,
>  	return -ENOLCK;
>  }
>
> +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
> +{
> +	return -ENOLCK;
> +}
> +

So, this is obviously wrong - thank you 0-day robot.  Yes, I did build and
test against these patches, but went back and added this after I realized it
should work w/o CONFIG_FILE_LOCKING.  I'll re-send.

Ben

>  static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
>  {
>  	return 0;
> @@ -1225,6 +1231,11 @@ static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
>  	return flock_lock_inode_wait(file_inode(filp), fl);
>  }
>
> +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
> +{
> +	return locks_lock_inode_wait(file_inode(filp), fl);
> +}
> +
>  struct fasync_struct {
>  	spinlock_t		fa_lock;
>  	int			magic;
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Cluster-devel] [PATCH 1/3] locks: introduce locks_lock_inode_wait()
@ 2015-10-22 16:21     ` Benjamin Coddington
  0 siblings, 0 replies; 38+ messages in thread
From: Benjamin Coddington @ 2015-10-22 16:21 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Thu, 22 Oct 2015, Benjamin Coddington wrote:

> Users of the locks API commonly call either posix_lock_file_wait() or
> flock_lock_file_wait() depending upon the lock type.  Add a new function
> locks_lock_inode_wait() which will check and call the correct function for
> the type of lock passed in.
>
> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
> ---
>  fs/locks.c         |   24 ++++++++++++++++++++++++
>  include/linux/fs.h |   11 +++++++++++
>  2 files changed, 35 insertions(+), 0 deletions(-)
>
> diff --git a/fs/locks.c b/fs/locks.c
> index 2a54c80..68b1784 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -1876,6 +1876,30 @@ int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
>  EXPORT_SYMBOL(flock_lock_inode_wait);
>
>  /**
> + * locks_lock_inode_wait - Apply a lock to an inode
> + * @inode: inode of the file to apply to
> + * @fl: The lock to be applied
> + *
> + * Apply a POSIX or FLOCK style lock request to an inode.
> + */
> +int locks_lock_inode_wait(struct inode *inode, struct file_lock *fl)
> +{
> +	int res = 0;
> +	switch (fl->fl_flags & (FL_POSIX|FL_FLOCK)) {
> +		case FL_POSIX:
> +			res = posix_lock_inode_wait(inode, fl);
> +			break;
> +		case FL_FLOCK:
> +			res = flock_lock_inode_wait(inode, fl);
> +			break;
> +		default:
> +			BUG();
> +	}
> +	return res;
> +}
> +EXPORT_SYMBOL(locks_lock_inode_wait);
> +
> +/**
>   *	sys_flock: - flock() system call.
>   *	@fd: the file descriptor to lock.
>   *	@cmd: the type of lock to apply.
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 72d8a84..2e283b7 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1059,6 +1059,7 @@ extern int vfs_test_lock(struct file *, struct file_lock *);
>  extern int vfs_lock_file(struct file *, unsigned int, struct file_lock *, struct file_lock *);
>  extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
>  extern int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl);
> +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);
>  extern void lease_get_mtime(struct inode *, struct timespec *time);
>  extern int generic_setlease(struct file *, long, struct file_lock **, void **priv);
> @@ -1177,6 +1178,11 @@ static inline int flock_lock_inode_wait(struct inode *inode,
>  	return -ENOLCK;
>  }
>
> +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
> +{
> +	return -ENOLCK;
> +}
> +

So, this is obviously wrong - thank you 0-day robot.  Yes, I did build and
test against these patches, but went back and added this after I realized it
should work w/o CONFIG_FILE_LOCKING.  I'll re-send.

Ben

>  static inline int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
>  {
>  	return 0;
> @@ -1225,6 +1231,11 @@ static inline int flock_lock_file_wait(struct file *filp, struct file_lock *fl)
>  	return flock_lock_inode_wait(file_inode(filp), fl);
>  }
>
> +static inline int locks_lock_file_wait(struct file *filp, struct file_lock *fl)
> +{
> +	return locks_lock_inode_wait(file_inode(filp), fl);
> +}
> +
>  struct fasync_struct {
>  	spinlock_t		fa_lock;
>  	int			magic;
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC PATCH] locks: posix_lock_inode_wait() can be static
  2015-10-22 15:35   ` Benjamin Coddington
  (?)
  (?)
@ 2015-10-22 16:36     ` kbuild test robot
  -1 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 16:36 UTC (permalink / raw)
  To: Benjamin Coddington
  Cc: kbuild-all, Jeff Layton, J. Bruce Fields, Alexander Viro,
	Latchesar Ionkov, linux-fsdevel, Trond Myklebust, devel,
	Yan Zheng, cluster-devel, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel, Christine Caulfield,
	v9fs-developer, Ilya Dryomov, linux-cifs, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel, Abdu


Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
 locks.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index daf4664..0d2b326 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1173,7 +1173,7 @@ EXPORT_SYMBOL(posix_lock_file);
  *
  * Apply a POSIX style lock request to an inode.
  */
-int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+static int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
 	int error;
 	might_sleep ();
@@ -1860,7 +1860,7 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
  *
  * Apply a FLOCK style lock request to an inode.
  */
-int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+static int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
 	int error;
 	might_sleep();

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait
  2015-10-22 15:35   ` Benjamin Coddington
                       ` (2 preceding siblings ...)
  (?)
@ 2015-10-22 16:36     ` kbuild test robot
  -1 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 16:36 UTC (permalink / raw)
  To: Benjamin Coddington
  Cc: Latchesar Ionkov, Christoph Hellwig, Trond Myklebust,
	J. Bruce Fields, Bob Peterson, Jeff Layton, devel, linux-cifs,
	Sage Weil, Miklos Szeredi, Steve French, cluster-devel,
	Eric Van Hensbergen, Christine Caulfield, v9fs-developer,
	Ilya Dryomov, fuse-devel, Mark Fasheh, Oleg Drokin, Julia Lawall,
	David Teigland, Alexander Viro, ceph-devel, Abdul Hussain,
	Steven

Hi Benjamin,

[auto build test WARNING on jlayton/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Coddington/locks-introduce-locks_lock_inode_wait/20151022-233848
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> fs/locks.c:1176:5: sparse: symbol 'posix_lock_inode_wait' was not declared. Should it be static?
>> fs/locks.c:1863:5: sparse: symbol 'flock_lock_inode_wait' was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [RFC PATCH] locks: posix_lock_inode_wait() can be static
@ 2015-10-22 16:36     ` kbuild test robot
  0 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 16:36 UTC (permalink / raw)
  To: Benjamin Coddington
  Cc: kbuild-all, Jeff Layton, J. Bruce Fields, Alexander Viro,
	Latchesar Ionkov, linux-fsdevel, Trond Myklebust, devel,
	Yan Zheng, cluster-devel, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel, Christine Caulfield,
	v9fs-developer, Ilya Dryomov, linux-cifs, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel, Abdul Hussain, Steven Whitehouse,
	linux-nfs, Andreas Dilger, Greg Kroah-Hartman, samba-technical,
	linux-kernel, Steve French, Bob Peterson, Ron Minnich,
	Anna Schumaker, ocfs2-devel, lustre-devel


Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
 locks.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index daf4664..0d2b326 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1173,7 +1173,7 @@ EXPORT_SYMBOL(posix_lock_file);
  *
  * Apply a POSIX style lock request to an inode.
  */
-int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+static int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
 	int error;
 	might_sleep ();
@@ -1860,7 +1860,7 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
  *
  * Apply a FLOCK style lock request to an inode.
  */
-int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+static int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
 	int error;
 	might_sleep();

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait
@ 2015-10-22 16:36     ` kbuild test robot
  0 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 16:36 UTC (permalink / raw)
  To: Benjamin Coddington
  Cc: kbuild-all, Jeff Layton, J. Bruce Fields, Alexander Viro,
	Latchesar Ionkov, linux-fsdevel, Trond Myklebust, devel,
	Yan Zheng, cluster-devel, Sage Weil, Miklos Szeredi,
	Christoph Hellwig, fuse-devel, Christine Caulfield,
	v9fs-developer, Ilya Dryomov, linux-cifs, Eric Van Hensbergen,
	Mark Fasheh, Oleg Drokin, Julia Lawall, David Teigland,
	Joel Becker, ceph-devel, Abdul Hussain, Steven Whitehouse,
	linux-nfs, Andreas Dilger, Greg Kroah-Hartman, samba-technical,
	linux-kernel, Steve French, Bob Peterson, Ron Minnich,
	Anna Schumaker, ocfs2-devel, lustre-devel

Hi Benjamin,

[auto build test WARNING on jlayton/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Coddington/locks-introduce-locks_lock_inode_wait/20151022-233848
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> fs/locks.c:1176:5: sparse: symbol 'posix_lock_inode_wait' was not declared. Should it be static?
>> fs/locks.c:1863:5: sparse: symbol 'flock_lock_inode_wait' was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait
@ 2015-10-22 16:36     ` kbuild test robot
  0 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 16:36 UTC (permalink / raw)
  To: Benjamin Coddington
  Cc: Latchesar Ionkov, Christoph Hellwig, Trond Myklebust,
	J. Bruce Fields, Bob Peterson, Jeff Layton, devel, linux-cifs,
	Sage Weil, Miklos Szeredi, Steve French, cluster-devel,
	Eric Van Hensbergen, Christine Caulfield, v9fs-developer,
	Ilya Dryomov, fuse-devel, Mark Fasheh, Oleg Drokin, Julia Lawall,
	David Teigland, Alexander Viro, ceph-devel, Abdul Hussain,
	Steven

Hi Benjamin,

[auto build test WARNING on jlayton/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Coddington/locks-introduce-locks_lock_inode_wait/20151022-233848
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> fs/locks.c:1176:5: sparse: symbol 'posix_lock_inode_wait' was not declared. Should it be static?
>> fs/locks.c:1863:5: sparse: symbol 'flock_lock_inode_wait' was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [lustre-devel] [RFC PATCH] locks: posix_lock_inode_wait() can be static
@ 2015-10-22 16:36     ` kbuild test robot
  0 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 16:36 UTC (permalink / raw)
  To: lustre-devel


Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
 locks.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index daf4664..0d2b326 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1173,7 +1173,7 @@ EXPORT_SYMBOL(posix_lock_file);
  *
  * Apply a POSIX style lock request to an inode.
  */
-int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+static int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
 	int error;
 	might_sleep ();
@@ -1860,7 +1860,7 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
  *
  * Apply a FLOCK style lock request to an inode.
  */
-int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+static int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
 	int error;
 	might_sleep();

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [lustre-devel] [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait
@ 2015-10-22 16:36     ` kbuild test robot
  0 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 16:36 UTC (permalink / raw)
  To: lustre-devel

Hi Benjamin,

[auto build test WARNING on jlayton/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Coddington/locks-introduce-locks_lock_inode_wait/20151022-233848
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> fs/locks.c:1176:5: sparse: symbol 'posix_lock_inode_wait' was not declared. Should it be static?
>> fs/locks.c:1863:5: sparse: symbol 'flock_lock_inode_wait' was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [Cluster-devel] [RFC PATCH] locks: posix_lock_inode_wait() can be static
@ 2015-10-22 16:36     ` kbuild test robot
  0 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 16:36 UTC (permalink / raw)
  To: cluster-devel.redhat.com


Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
 locks.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index daf4664..0d2b326 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1173,7 +1173,7 @@ EXPORT_SYMBOL(posix_lock_file);
  *
  * Apply a POSIX style lock request to an inode.
  */
-int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+static int posix_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
 	int error;
 	might_sleep ();
@@ -1860,7 +1860,7 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
  *
  * Apply a FLOCK style lock request to an inode.
  */
-int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
+static int flock_lock_inode_wait(struct inode *inode, struct file_lock *fl)
 {
 	int error;
 	might_sleep();



^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [Cluster-devel] [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait
@ 2015-10-22 16:36     ` kbuild test robot
  0 siblings, 0 replies; 38+ messages in thread
From: kbuild test robot @ 2015-10-22 16:36 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Hi Benjamin,

[auto build test WARNING on jlayton/linux-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Coddington/locks-introduce-locks_lock_inode_wait/20151022-233848
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> fs/locks.c:1176:5: sparse: symbol 'posix_lock_inode_wait' was not declared. Should it be static?
>> fs/locks.c:1863:5: sparse: symbol 'flock_lock_inode_wait' was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation



^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2015-10-22 16:38 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-22 15:35 [PATCH 0/3] Minor cleanup for locks API Benjamin Coddington
2015-10-22 15:35 ` [Cluster-devel] " Benjamin Coddington
2015-10-22 15:35 ` [lustre-devel] " Benjamin Coddington
2015-10-22 15:35 ` Benjamin Coddington
2015-10-22 15:35 ` Benjamin Coddington
2015-10-22 15:35 ` [PATCH 1/3] locks: introduce locks_lock_inode_wait() Benjamin Coddington
2015-10-22 15:35   ` [Cluster-devel] " Benjamin Coddington
2015-10-22 15:35   ` [lustre-devel] " Benjamin Coddington
2015-10-22 15:35   ` Benjamin Coddington
2015-10-22 15:35   ` Benjamin Coddington
     [not found]   ` <daf0d3941f34438c1fbdc94a5f3a47c2b22f3ee8.1445524157.git.bcodding-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-10-22 15:59     ` kbuild test robot
2015-10-22 15:59       ` [Cluster-devel] " kbuild test robot
2015-10-22 15:59       ` [lustre-devel] " kbuild test robot
2015-10-22 15:59       ` kbuild test robot
2015-10-22 16:21   ` Benjamin Coddington
2015-10-22 16:21     ` [Cluster-devel] " Benjamin Coddington
2015-10-22 16:21     ` [lustre-devel] " Benjamin Coddington
2015-10-22 16:21     ` Benjamin Coddington
2015-10-22 16:21     ` Benjamin Coddington
2015-10-22 15:35 ` [PATCH 2/3] Move locks API users to locks_lock_inode_wait() Benjamin Coddington
2015-10-22 15:35   ` [Cluster-devel] " Benjamin Coddington
2015-10-22 15:35   ` [lustre-devel] " Benjamin Coddington
2015-10-22 15:35   ` Benjamin Coddington
2015-10-22 15:35   ` Benjamin Coddington
2015-10-22 15:35 ` [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait Benjamin Coddington
2015-10-22 15:35   ` [Cluster-devel] " Benjamin Coddington
2015-10-22 15:35   ` [lustre-devel] " Benjamin Coddington
2015-10-22 15:35   ` Benjamin Coddington
2015-10-22 15:35   ` Benjamin Coddington
2015-10-22 16:36   ` [RFC PATCH] locks: posix_lock_inode_wait() can be static kbuild test robot
2015-10-22 16:36     ` [Cluster-devel] " kbuild test robot
2015-10-22 16:36     ` [lustre-devel] " kbuild test robot
2015-10-22 16:36     ` kbuild test robot
2015-10-22 16:36   ` [PATCH 3/3] locks: cleanup posix_lock_inode_wait and flock_lock_inode_wait kbuild test robot
2015-10-22 16:36     ` [Cluster-devel] " kbuild test robot
2015-10-22 16:36     ` [lustre-devel] " kbuild test robot
2015-10-22 16:36     ` kbuild test robot
2015-10-22 16:36     ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.