linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/5] locks: implement "filp-private" (aka UNPOSIX) locks
@ 2013-11-20 16:45 Jeff Layton
  2013-11-20 16:45 ` [RFC PATCH v2 1/5] locks: consolidate checks for compatible filp->f_mode values in setlk handlers Jeff Layton
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Jeff Layton @ 2013-11-20 16:45 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, nfs-ganesha-devel, samba-technical

This patchset is the second posting of this set. Here's an overview of
the changes:

The inheritance semantics have been changed to be much more like BSD
(aka flock()) locks. With this change, what we basically have are a
hybrid of BSD and POSIX locks. They conflict with "classic" POSIX locks
but are not noticed by flock() locks.  OTOH, they act like flock locks
with respect to inheritance and behavior when an fd is closed.

This change actually makes the patchset smaller. Instead of needing a
bunch of special handling, we can simply consider these new locks to be
a POSIX lock like any other and simply give them a different fl_owner
value (that of the filp). This does mean that we need to add a new
F_UNLCKP l_type value, but I think that's a reasonable thing to do
anyway.

Note too that I've gone ahead and opened a request for the POSIX folks
to consider adding this to the POSIX spec once we have something
mergeable. They seem amenable to the idea but don't want to enshrine it
into the standard until there's a real implementation of it:

    http://austingroupbugs.net/view.php?id=768

The code changes are pretty straightforward, so my questions are pretty
much the same as that in the last set. Cover letter from the v1 posting
follows.

Comments and suggestions welcome...

-------------------------------[snip]------------------------------

At LSF this year, there was a discussion about the "wishlist" for
userland file servers. One of the things brought up was the goofy and
problematic behavior of POSIX locks when a file is closed. Boaz started
a thread on it here:

    http://permalink.gmane.org/gmane.linux.file-systems/73364

Userland fileservers often need to maintain more than one open file
descriptor on a file. The POSIX spec says:

"All locks associated with a file for a given process shall be removed
 when a file descriptor for that file is closed by that process or the
 process holding that file descriptor terminates."

This is problematic since you can't close any file descriptor without
dropping all your POSIX locks. Most userland file servers therefore
end up opening the file with more access than is really necessary, and
keeping fd's open for longer than is necessary to work around this.

This patchset is a first stab at an approach to address this problem by
adding two new l_type values -- F_RDLCKP and F_WRLCKP (the 'P' is short
for "private" -- I'm open to changing that if you have a better
mnemonic).

For all intents and purposes these lock types act just like their
"non-P" counterpart. The difference is that they are only implicitly
released when the fd against which they were acquired is closed. As a
side effect, these locks cannot be merged with "non-P" locks since they
have different semantics on close.

I've given this patchset some very basic smoke testing and it seems to
do the right thing, but it is still pretty rough. If this looks
reasonable I'll plan to do some documentation updates and will take a
stab at trying to get these new lock types added to the POSIX spec (as
HCH recommended).

At this point, my main questions are:

1) does this look useful, particularly for fileserver implementors?

2) does this look OK API-wise? We could consider different "cmd" values
   or even different syscalls, but I figured this makes it clearer that
   "P" and "non-P" locks will still conflict with one another.

Jeff Layton (5):
  locks: consolidate checks for compatible filp->f_mode values in setlk
    handlers
  locks: rename locks_remove_flock to locks_remove_filp
  locks: add new "private" lock type that is owned by the filp
  locks: show private lock types in /proc/locks
  locks: report l_pid as -1 for FL_FILP_PRIVATE locks

 fs/file_table.c                  |   2 +-
 fs/locks.c                       | 102 ++++++++++++++++++++++-----------------
 include/linux/fs.h               |   5 +-
 include/uapi/asm-generic/fcntl.h |  15 ++++++
 4 files changed, 78 insertions(+), 46 deletions(-)

-- 
1.8.3.1


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

* [RFC PATCH v2 1/5] locks: consolidate checks for compatible filp->f_mode values in setlk handlers
  2013-11-20 16:45 [RFC PATCH v2 0/5] locks: implement "filp-private" (aka UNPOSIX) locks Jeff Layton
@ 2013-11-20 16:45 ` Jeff Layton
  2013-11-21 17:35   ` Christoph Hellwig
  2013-11-20 16:45 ` [RFC PATCH v2 2/5] locks: rename locks_remove_flock to locks_remove_filp Jeff Layton
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 18+ messages in thread
From: Jeff Layton @ 2013-11-20 16:45 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, nfs-ganesha-devel, samba-technical

Add a wrapper around assign_type that does this instead of duplicating
this check in two places. This also fixes a minor wart in the code where
we continue referring to the struct flock after converting it to struct
file_lock.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/locks.c | 61 +++++++++++++++++++++++++------------------------------------
 1 file changed, 25 insertions(+), 36 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 92a0f0a..a387ef7 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -344,6 +344,29 @@ static int assign_type(struct file_lock *fl, long type)
 	return 0;
 }
 
+static int posix_assign_type(struct file_lock *fl, long type)
+{
+	int err;
+
+	err = assign_type(fl, type);
+	if (err)
+		return err;
+
+	/* Ensure that fl->fl_filp has compatible f_mode */
+	switch (fl->fl_type) {
+	case F_RDLCK:
+		if (!(fl->fl_file->f_mode & FMODE_READ))
+			return -EBADF;
+		break;
+	case F_WRLCK:
+		if (!(fl->fl_file->f_mode & FMODE_WRITE))
+			return -EBADF;
+		break;
+	}
+
+	return 0;
+}
+
 /* Verify a "struct flock" and copy it to a "struct file_lock" as a POSIX
  * style lock.
  */
@@ -393,7 +416,7 @@ static int flock_to_posix_lock(struct file *filp, struct file_lock *fl,
 	fl->fl_ops = NULL;
 	fl->fl_lmops = NULL;
 
-	return assign_type(fl, l->l_type);
+	return posix_assign_type(fl, l->l_type);
 }
 
 #if BITS_PER_LONG == 32
@@ -439,7 +462,7 @@ static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl,
 	fl->fl_ops = NULL;
 	fl->fl_lmops = NULL;
 
-	return assign_type(fl, l->l_type);
+	return posix_assign_type(fl, l->l_type);
 }
 #endif
 
@@ -2016,23 +2039,6 @@ again:
 		file_lock->fl_flags |= FL_SLEEP;
 	}
 	
-	error = -EBADF;
-	switch (flock.l_type) {
-	case F_RDLCK:
-		if (!(filp->f_mode & FMODE_READ))
-			goto out;
-		break;
-	case F_WRLCK:
-		if (!(filp->f_mode & FMODE_WRITE))
-			goto out;
-		break;
-	case F_UNLCK:
-		break;
-	default:
-		error = -EINVAL;
-		goto out;
-	}
-
 	error = do_lock_file_wait(filp, cmd, file_lock);
 
 	/*
@@ -2134,23 +2140,6 @@ again:
 		file_lock->fl_flags |= FL_SLEEP;
 	}
 	
-	error = -EBADF;
-	switch (flock.l_type) {
-	case F_RDLCK:
-		if (!(filp->f_mode & FMODE_READ))
-			goto out;
-		break;
-	case F_WRLCK:
-		if (!(filp->f_mode & FMODE_WRITE))
-			goto out;
-		break;
-	case F_UNLCK:
-		break;
-	default:
-		error = -EINVAL;
-		goto out;
-	}
-
 	error = do_lock_file_wait(filp, cmd, file_lock);
 
 	/*
-- 
1.8.3.1


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

* [RFC PATCH v2 2/5] locks: rename locks_remove_flock to locks_remove_filp
  2013-11-20 16:45 [RFC PATCH v2 0/5] locks: implement "filp-private" (aka UNPOSIX) locks Jeff Layton
  2013-11-20 16:45 ` [RFC PATCH v2 1/5] locks: consolidate checks for compatible filp->f_mode values in setlk handlers Jeff Layton
@ 2013-11-20 16:45 ` Jeff Layton
  2013-11-21 17:35   ` Christoph Hellwig
  2013-11-20 16:45 ` [RFC PATCH v2 3/5] locks: add new "private" lock type that is owned by the filp Jeff Layton
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 18+ messages in thread
From: Jeff Layton @ 2013-11-20 16:45 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, nfs-ganesha-devel, samba-technical

This function currently removes leases in addition to flock locks, so
the name is misleading. Rename it to locks_remove_filp to indicate that
it removes locks that are associated with a particular filp.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/file_table.c    | 2 +-
 fs/locks.c         | 2 +-
 include/linux/fs.h | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/file_table.c b/fs/file_table.c
index 5fff903..5c83bf3 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -234,7 +234,7 @@ static void __fput(struct file *file)
 	 * in the file cleanup chain.
 	 */
 	eventpoll_release(file);
-	locks_remove_flock(file);
+	locks_remove_filp(file);
 
 	if (unlikely(file->f_flags & FASYNC)) {
 		if (file->f_op->fasync)
diff --git a/fs/locks.c b/fs/locks.c
index a387ef7..86cafc3 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2198,7 +2198,7 @@ EXPORT_SYMBOL(locks_remove_posix);
 /*
  * This function is called on the last close of an open file.
  */
-void locks_remove_flock(struct file *filp)
+void locks_remove_filp(struct file *filp)
 {
 	struct inode * inode = file_inode(filp);
 	struct file_lock *fl;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index bf5d574..2d890ce 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1012,7 +1012,7 @@ extern struct file_lock * locks_alloc_lock(void);
 extern void locks_copy_lock(struct file_lock *, struct file_lock *);
 extern void __locks_copy_lock(struct file_lock *, const struct file_lock *);
 extern void locks_remove_posix(struct file *, fl_owner_t);
-extern void locks_remove_flock(struct file *);
+extern void locks_remove_filp(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 *);
@@ -1083,7 +1083,7 @@ static inline void locks_remove_posix(struct file *filp, fl_owner_t owner)
 	return;
 }
 
-static inline void locks_remove_flock(struct file *filp)
+static inline void locks_remove_filp(struct file *filp)
 {
 	return;
 }
-- 
1.8.3.1


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

* [RFC PATCH v2 3/5] locks: add new "private" lock type that is owned by the filp
  2013-11-20 16:45 [RFC PATCH v2 0/5] locks: implement "filp-private" (aka UNPOSIX) locks Jeff Layton
  2013-11-20 16:45 ` [RFC PATCH v2 1/5] locks: consolidate checks for compatible filp->f_mode values in setlk handlers Jeff Layton
  2013-11-20 16:45 ` [RFC PATCH v2 2/5] locks: rename locks_remove_flock to locks_remove_filp Jeff Layton
@ 2013-11-20 16:45 ` Jeff Layton
  2013-11-20 19:50   ` J. Bruce Fields
  2013-11-21 17:36   ` Christoph Hellwig
  2013-11-20 16:45 ` [RFC PATCH v2 4/5] locks: show private lock types in /proc/locks Jeff Layton
  2013-11-20 16:45 ` [RFC PATCH v2 5/5] locks: report l_pid as -1 for FL_FILP_PRIVATE locks Jeff Layton
  4 siblings, 2 replies; 18+ messages in thread
From: Jeff Layton @ 2013-11-20 16:45 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, nfs-ganesha-devel, samba-technical

Due to some unfortunate history, POSIX locks have very strange and
unhelpful semantics. The thing that usually catches people by surprise
is that they are dropped whenever the process closes any file descriptor
associated with the inode.

This is extremely problematic for people developing file servers that
need to implement byte-range locks. Developers often need a "lock
management" facility to ensure that file descriptors are not closed
until all of the locks associated with the inode are finished.

This patchset adds a new type of lock that attempts to address this
issue. These locks work just like "normal" POSIX read/write locks, but
have semantics that are more like BSD locks with respect to inheritance
and behavior on close.

This is implemented primarily by changing how fl_owner field is set for
these locks. Instead of having them owned by the files_struct of the
process, they are instead owned by the filp on which they were acquired.
Thus, they are inherited across fork() and are only released when the
last reference to a filp is put.

These new semantics prevent them from being merged with "classic" POSIX
locks, even if they are acquired by the same process. These locks will
also conflict with "classic" POSIX locks even if they are acquired by
the same process or on the same file descriptor.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/locks.c                       | 22 +++++++++++++++++++++-
 include/uapi/asm-generic/fcntl.h | 15 +++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/fs/locks.c b/fs/locks.c
index 86cafc3..3b278a6 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -348,6 +348,26 @@ static int posix_assign_type(struct file_lock *fl, long type)
 {
 	int err;
 
+	/*
+	 * FL_FILP_PRIVATE locks are "owned" by the filp upon which they were
+	 * acquired, regardless of what task is dealing with them. Set the
+	 * fl_owner appropriately.
+	 */
+	switch (type) {
+	case F_RDLCKP:
+		type = F_RDLCK;
+		fl->fl_owner = (fl_owner_t)fl->fl_file;
+		break;
+	case F_WRLCKP:
+		type = F_WRLCK;
+		fl->fl_owner = (fl_owner_t)fl->fl_file;
+		break;
+	case F_UNLCKP:
+		type = F_UNLCK;
+		fl->fl_owner = (fl_owner_t)fl->fl_file;
+		break;
+	}
+
 	err = assign_type(fl, type);
 	if (err)
 		return err;
@@ -2225,7 +2245,7 @@ void locks_remove_filp(struct file *filp)
 
 	while ((fl = *before) != NULL) {
 		if (fl->fl_file == filp) {
-			if (IS_FLOCK(fl)) {
+			if (IS_FLOCK(fl) || IS_POSIX(fl)) {
 				locks_delete_lock(before);
 				continue;
 			}
diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
index 95e46c8..6b7b68a 100644
--- a/include/uapi/asm-generic/fcntl.h
+++ b/include/uapi/asm-generic/fcntl.h
@@ -151,6 +151,21 @@ struct f_owner_ex {
 #define F_UNLCK		2
 #endif
 
+/*
+ * fd "private" POSIX locks.
+ *
+ * Usually POSIX locks held by a process are released on *any* close and are
+ * not inherited across a fork().
+ *
+ * These lock types will conflict with normal POSIX locks, but are "owned"
+ * by the fd, not the process. This means that they are inherited across
+ * fork() like BSD (flock) locks, and they are only closed when the last
+ * reference to the the filp against which were acquired is closed.
+ */
+#define F_RDLCKP	5
+#define F_WRLCKP	6
+#define F_UNLCKP	7
+
 /* for old implementation of bsd flock () */
 #ifndef F_EXLCK
 #define F_EXLCK		4	/* or 3 */
-- 
1.8.3.1


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

* [RFC PATCH v2 4/5] locks: show private lock types in /proc/locks
  2013-11-20 16:45 [RFC PATCH v2 0/5] locks: implement "filp-private" (aka UNPOSIX) locks Jeff Layton
                   ` (2 preceding siblings ...)
  2013-11-20 16:45 ` [RFC PATCH v2 3/5] locks: add new "private" lock type that is owned by the filp Jeff Layton
@ 2013-11-20 16:45 ` Jeff Layton
  2013-11-20 20:00   ` J. Bruce Fields
  2013-11-20 16:45 ` [RFC PATCH v2 5/5] locks: report l_pid as -1 for FL_FILP_PRIVATE locks Jeff Layton
  4 siblings, 1 reply; 18+ messages in thread
From: Jeff Layton @ 2013-11-20 16:45 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, nfs-ganesha-devel, samba-technical

Show "private" locks in /proc/locks with a 'P' suffix. This does mean
that we need to widen the column by one character.

Also, tighten up the check in locks_remove_filp() to ensure that only
IS_FILP_PVT locks are removed there.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/locks.c         | 15 +++++++++++----
 include/linux/fs.h |  1 +
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 3b278a6..d5fb853 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -135,6 +135,7 @@
 #define IS_POSIX(fl)	(fl->fl_flags & FL_POSIX)
 #define IS_FLOCK(fl)	(fl->fl_flags & FL_FLOCK)
 #define IS_LEASE(fl)	(fl->fl_flags & (FL_LEASE|FL_DELEG))
+#define IS_FILP_PVT(fl)	(fl->fl_flags & FL_FILP_PRIVATE)
 
 static bool lease_breaking(struct file_lock *fl)
 {
@@ -357,14 +358,17 @@ static int posix_assign_type(struct file_lock *fl, long type)
 	case F_RDLCKP:
 		type = F_RDLCK;
 		fl->fl_owner = (fl_owner_t)fl->fl_file;
+		fl->fl_flags |= FL_FILP_PRIVATE;
 		break;
 	case F_WRLCKP:
 		type = F_WRLCK;
 		fl->fl_owner = (fl_owner_t)fl->fl_file;
+		fl->fl_flags |= FL_FILP_PRIVATE;
 		break;
 	case F_UNLCKP:
 		type = F_UNLCK;
 		fl->fl_owner = (fl_owner_t)fl->fl_file;
+		fl->fl_flags |= FL_FILP_PRIVATE;
 		break;
 	}
 
@@ -2245,7 +2249,8 @@ void locks_remove_filp(struct file *filp)
 
 	while ((fl = *before) != NULL) {
 		if (fl->fl_file == filp) {
-			if (IS_FLOCK(fl) || IS_POSIX(fl)) {
+			if (IS_FLOCK(fl) ||
+			    (IS_POSIX(fl) && IS_FILP_PVT(fl))) {
 				locks_delete_lock(before);
 				continue;
 			}
@@ -2345,13 +2350,15 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
 		seq_printf(f, "UNKNOWN UNKNOWN  ");
 	}
 	if (fl->fl_type & LOCK_MAND) {
-		seq_printf(f, "%s ",
+		seq_printf(f, "%s  ",
 			       (fl->fl_type & LOCK_READ)
 			       ? (fl->fl_type & LOCK_WRITE) ? "RW   " : "READ "
 			       : (fl->fl_type & LOCK_WRITE) ? "WRITE" : "NONE ");
+	} else if (IS_FILP_PVT(fl)) {
+		seq_printf(f, "%s ", fl->fl_type == F_WRLCK ?  "WRITEP" : "READP ");
 	} else {
-		seq_printf(f, "%s ",
-			       (lease_breaking(fl))
+		seq_printf(f, "%s  ",
+			       lease_breaking(fl)
 			       ? (fl->fl_type == F_UNLCK) ? "UNLCK" : "READ "
 			       : (fl->fl_type == F_WRLCK) ? "WRITE" : "READ ");
 	}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 2d890ce..9890bac 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -888,6 +888,7 @@ static inline int file_check_writeable(struct file *filp)
 #define FL_SLEEP	128	/* A blocking lock */
 #define FL_DOWNGRADE_PENDING	256 /* Lease is being downgraded */
 #define FL_UNLOCK_PENDING	512 /* Lease is being broken */
+#define FL_FILP_PRIVATE	1024	/* lock is private to the filp */
 
 /*
  * Special return value from posix_lock_file() and vfs_lock_file() for
-- 
1.8.3.1


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

* [RFC PATCH v2 5/5] locks: report l_pid as -1 for FL_FILP_PRIVATE locks
  2013-11-20 16:45 [RFC PATCH v2 0/5] locks: implement "filp-private" (aka UNPOSIX) locks Jeff Layton
                   ` (3 preceding siblings ...)
  2013-11-20 16:45 ` [RFC PATCH v2 4/5] locks: show private lock types in /proc/locks Jeff Layton
@ 2013-11-20 16:45 ` Jeff Layton
  2013-11-20 17:55   ` Frank Filz
  4 siblings, 1 reply; 18+ messages in thread
From: Jeff Layton @ 2013-11-20 16:45 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: linux-kernel, nfs-ganesha-devel, samba-technical

FL_FILP_PRIVATE locks are no longer tied to a particular PID, and are
instead inheritable by child processes. Report a l_pid of '-1' for
these sorts of locks since the pid is somewhat meaningless for them.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/locks.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index d5fb853..8a4d4e4 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1889,7 +1889,7 @@ EXPORT_SYMBOL_GPL(vfs_test_lock);
 
 static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl)
 {
-	flock->l_pid = fl->fl_pid;
+	flock->l_pid = IS_FILP_PVT(fl) ? -1 : fl->fl_pid;
 #if BITS_PER_LONG == 32
 	/*
 	 * Make sure we can represent the posix lock via
@@ -1911,7 +1911,7 @@ static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl)
 #if BITS_PER_LONG == 32
 static void posix_lock_to_flock64(struct flock64 *flock, struct file_lock *fl)
 {
-	flock->l_pid = fl->fl_pid;
+	flock->l_pid = IS_FILP_PVT(fl) ? -1 : fl->fl_pid;
 	flock->l_start = fl->fl_start;
 	flock->l_len = fl->fl_end == OFFSET_MAX ? 0 :
 		fl->fl_end - fl->fl_start + 1;
-- 
1.8.3.1


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

* RE: [RFC PATCH v2 5/5] locks: report l_pid as -1 for FL_FILP_PRIVATE locks
  2013-11-20 16:45 ` [RFC PATCH v2 5/5] locks: report l_pid as -1 for FL_FILP_PRIVATE locks Jeff Layton
@ 2013-11-20 17:55   ` Frank Filz
  2013-11-20 18:57     ` Jeff Layton
  0 siblings, 1 reply; 18+ messages in thread
From: Frank Filz @ 2013-11-20 17:55 UTC (permalink / raw)
  To: 'Jeff Layton', linux-fsdevel
  Cc: linux-kernel, nfs-ganesha-devel, samba-technical

> FL_FILP_PRIVATE locks are no longer tied to a particular PID, and are
instead
> inheritable by child processes. Report a l_pid of '-1' for these sorts of
locks
> since the pid is somewhat meaningless for them.

Hmm, I suppose in the case of a process that acquires a private lock, forks
(passing the lock to the child process) and then exits, pid would be
meaningless, but I wonder how common that case is compared to a
multi-threaded process (especially a file server) that will hold many
private locks, and not pass them to child processes (and exit)?

I.e. as a future user of this feature, I wonder if I'm going to want to know
that THESE private locks are owned by Ganesha and THOSE are owned by Samba?

Frank

> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/locks.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/locks.c b/fs/locks.c
> index d5fb853..8a4d4e4 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -1889,7 +1889,7 @@ EXPORT_SYMBOL_GPL(vfs_test_lock);
> 
>  static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl)
{
> -	flock->l_pid = fl->fl_pid;
> +	flock->l_pid = IS_FILP_PVT(fl) ? -1 : fl->fl_pid;
>  #if BITS_PER_LONG == 32
>  	/*
>  	 * Make sure we can represent the posix lock via @@ -1911,7 +1911,7
> @@ static int posix_lock_to_flock(struct flock *flock, struct file_lock
*fl)  #if
> BITS_PER_LONG == 32  static void posix_lock_to_flock64(struct flock64
> *flock, struct file_lock *fl)  {
> -	flock->l_pid = fl->fl_pid;
> +	flock->l_pid = IS_FILP_PVT(fl) ? -1 : fl->fl_pid;
>  	flock->l_start = fl->fl_start;
>  	flock->l_len = fl->fl_end == OFFSET_MAX ? 0 :
>  		fl->fl_end - fl->fl_start + 1;
> --
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel"
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] 18+ messages in thread

* Re: [RFC PATCH v2 5/5] locks: report l_pid as -1 for FL_FILP_PRIVATE locks
  2013-11-20 17:55   ` Frank Filz
@ 2013-11-20 18:57     ` Jeff Layton
  0 siblings, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2013-11-20 18:57 UTC (permalink / raw)
  To: Frank Filz
  Cc: linux-fsdevel, linux-kernel, nfs-ganesha-devel, samba-technical

On Wed, 20 Nov 2013 09:55:18 -0800
"Frank Filz" <ffilzlnx@mindspring.com> wrote:

> > FL_FILP_PRIVATE locks are no longer tied to a particular PID, and are
> instead
> > inheritable by child processes. Report a l_pid of '-1' for these sorts of
> locks
> > since the pid is somewhat meaningless for them.
> 
> Hmm, I suppose in the case of a process that acquires a private lock, forks
> (passing the lock to the child process) and then exits, pid would be
> meaningless, but I wonder how common that case is compared to a
> multi-threaded process (especially a file server) that will hold many
> private locks, and not pass them to child processes (and exit)?
> 
> I.e. as a future user of this feature, I wonder if I'm going to want to know
> that THESE private locks are owned by Ganesha and THOSE are owned by Samba?
> 
> Frank
> 

A fair point.

FWIW, I took the idea of reporting '-1' from BSD, where POSIX and flock
locks can apparently conflict. If a flock lock is held on a file and
you do a F_GETLK request, then it will report '-1' for the l_pid. [1]

I sort of expect that we may need to eventually add an F_GETLK variant
that gives more info. The main reason to do this here is that we need
to put something semi-meaningful in that field for "classic" F_GETLK
users.

[1]: hmm...probably should put that in the commit log message. I'll do
     that for the next respin...

> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > ---
> >  fs/locks.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/locks.c b/fs/locks.c
> > index d5fb853..8a4d4e4 100644
> > --- a/fs/locks.c
> > +++ b/fs/locks.c
> > @@ -1889,7 +1889,7 @@ EXPORT_SYMBOL_GPL(vfs_test_lock);
> > 
> >  static int posix_lock_to_flock(struct flock *flock, struct file_lock *fl)
> {
> > -	flock->l_pid = fl->fl_pid;
> > +	flock->l_pid = IS_FILP_PVT(fl) ? -1 : fl->fl_pid;
> >  #if BITS_PER_LONG == 32
> >  	/*
> >  	 * Make sure we can represent the posix lock via @@ -1911,7 +1911,7
> > @@ static int posix_lock_to_flock(struct flock *flock, struct file_lock
> *fl)  #if
> > BITS_PER_LONG == 32  static void posix_lock_to_flock64(struct flock64
> > *flock, struct file_lock *fl)  {
> > -	flock->l_pid = fl->fl_pid;
> > +	flock->l_pid = IS_FILP_PVT(fl) ? -1 : fl->fl_pid;
> >  	flock->l_start = fl->fl_start;
> >  	flock->l_len = fl->fl_end == OFFSET_MAX ? 0 :
> >  		fl->fl_end - fl->fl_start + 1;
> > --
> > 1.8.3.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel"
> in the
> > body of a message to majordomo@vger.kernel.org More majordomo info at
> > http://vger.kernel.org/majordomo-info.html
> 


-- 
Jeff Layton <jlayton@redhat.com>

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

* Re: [RFC PATCH v2 3/5] locks: add new "private" lock type that is owned by the filp
  2013-11-20 16:45 ` [RFC PATCH v2 3/5] locks: add new "private" lock type that is owned by the filp Jeff Layton
@ 2013-11-20 19:50   ` J. Bruce Fields
  2013-11-20 20:00     ` Jeff Layton
  2013-12-09 16:46     ` [Nfs-ganesha-devel] " Jeff Layton
  2013-11-21 17:36   ` Christoph Hellwig
  1 sibling, 2 replies; 18+ messages in thread
From: J. Bruce Fields @ 2013-11-20 19:50 UTC (permalink / raw)
  To: Jeff Layton
  Cc: linux-fsdevel, linux-kernel, nfs-ganesha-devel, samba-technical

On Wed, Nov 20, 2013 at 11:45:04AM -0500, Jeff Layton wrote:
> Due to some unfortunate history, POSIX locks have very strange and
> unhelpful semantics. The thing that usually catches people by surprise
> is that they are dropped whenever the process closes any file descriptor
> associated with the inode.
> 
> This is extremely problematic for people developing file servers that
> need to implement byte-range locks. Developers often need a "lock
> management" facility to ensure that file descriptors are not closed
> until all of the locks associated with the inode are finished.
> 
> This patchset adds a new type of lock that attempts to address this
> issue. These locks work just like "normal" POSIX read/write locks, but
> have semantics that are more like BSD locks with respect to inheritance
> and behavior on close.
> 
> This is implemented primarily by changing how fl_owner field is set for
> these locks. Instead of having them owned by the files_struct of the
> process, they are instead owned by the filp on which they were acquired.
> Thus, they are inherited across fork() and are only released when the
> last reference to a filp is put.
> 
> These new semantics prevent them from being merged with "classic" POSIX
> locks, even if they are acquired by the same process. These locks will
> also conflict with "classic" POSIX locks even if they are acquired by
> the same process or on the same file descriptor.
> 
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/locks.c                       | 22 +++++++++++++++++++++-
>  include/uapi/asm-generic/fcntl.h | 15 +++++++++++++++
>  2 files changed, 36 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/locks.c b/fs/locks.c
> index 86cafc3..3b278a6 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -348,6 +348,26 @@ static int posix_assign_type(struct file_lock *fl, long type)
>  {
>  	int err;
>  
> +	/*
> +	 * FL_FILP_PRIVATE locks are "owned" by the filp upon which they were
> +	 * acquired, regardless of what task is dealing with them. Set the
> +	 * fl_owner appropriately.
> +	 */
> +	switch (type) {
> +	case F_RDLCKP:
> +		type = F_RDLCK;
> +		fl->fl_owner = (fl_owner_t)fl->fl_file;
> +		break;
> +	case F_WRLCKP:
> +		type = F_WRLCK;
> +		fl->fl_owner = (fl_owner_t)fl->fl_file;
> +		break;
> +	case F_UNLCKP:
> +		type = F_UNLCK;
> +		fl->fl_owner = (fl_owner_t)fl->fl_file;
> +		break;
> +	}
> +

After this fl_owner gets set to current->files in
flock{64}_to_posix_lock and then reset here.  That seems like a trap for
the unwary reader.

Could you do something like rename this flock_to_posix_lock_common and
move all the 32/64-bit-independent initialization here?

Looks like there's way more duplication than necessary between those two
cases.

(Also, why do we have an fl_owner_t instead of using a void?)

--b.

>  	err = assign_type(fl, type);
>  	if (err)
>  		return err;
> @@ -2225,7 +2245,7 @@ void locks_remove_filp(struct file *filp)
>  
>  	while ((fl = *before) != NULL) {
>  		if (fl->fl_file == filp) {
> -			if (IS_FLOCK(fl)) {
> +			if (IS_FLOCK(fl) || IS_POSIX(fl)) {
>  				locks_delete_lock(before);
>  				continue;
>  			}
> diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
> index 95e46c8..6b7b68a 100644
> --- a/include/uapi/asm-generic/fcntl.h
> +++ b/include/uapi/asm-generic/fcntl.h
> @@ -151,6 +151,21 @@ struct f_owner_ex {
>  #define F_UNLCK		2
>  #endif
>  
> +/*
> + * fd "private" POSIX locks.
> + *
> + * Usually POSIX locks held by a process are released on *any* close and are
> + * not inherited across a fork().
> + *
> + * These lock types will conflict with normal POSIX locks, but are "owned"
> + * by the fd, not the process. This means that they are inherited across
> + * fork() like BSD (flock) locks, and they are only closed when the last
> + * reference to the the filp against which were acquired is closed.
> + */
> +#define F_RDLCKP	5
> +#define F_WRLCKP	6
> +#define F_UNLCKP	7
> +
>  /* for old implementation of bsd flock () */
>  #ifndef F_EXLCK
>  #define F_EXLCK		4	/* or 3 */
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" 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] 18+ messages in thread

* Re: [RFC PATCH v2 3/5] locks: add new "private" lock type that is owned by the filp
  2013-11-20 19:50   ` J. Bruce Fields
@ 2013-11-20 20:00     ` Jeff Layton
  2013-12-09 16:46     ` [Nfs-ganesha-devel] " Jeff Layton
  1 sibling, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2013-11-20 20:00 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: linux-fsdevel, linux-kernel, nfs-ganesha-devel, samba-technical

On Wed, 20 Nov 2013 14:50:32 -0500
"J. Bruce Fields" <bfields@fieldses.org> wrote:

> On Wed, Nov 20, 2013 at 11:45:04AM -0500, Jeff Layton wrote:
> > Due to some unfortunate history, POSIX locks have very strange and
> > unhelpful semantics. The thing that usually catches people by surprise
> > is that they are dropped whenever the process closes any file descriptor
> > associated with the inode.
> > 
> > This is extremely problematic for people developing file servers that
> > need to implement byte-range locks. Developers often need a "lock
> > management" facility to ensure that file descriptors are not closed
> > until all of the locks associated with the inode are finished.
> > 
> > This patchset adds a new type of lock that attempts to address this
> > issue. These locks work just like "normal" POSIX read/write locks, but
> > have semantics that are more like BSD locks with respect to inheritance
> > and behavior on close.
> > 
> > This is implemented primarily by changing how fl_owner field is set for
> > these locks. Instead of having them owned by the files_struct of the
> > process, they are instead owned by the filp on which they were acquired.
> > Thus, they are inherited across fork() and are only released when the
> > last reference to a filp is put.
> > 
> > These new semantics prevent them from being merged with "classic" POSIX
> > locks, even if they are acquired by the same process. These locks will
> > also conflict with "classic" POSIX locks even if they are acquired by
> > the same process or on the same file descriptor.
> > 
> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > ---
> >  fs/locks.c                       | 22 +++++++++++++++++++++-
> >  include/uapi/asm-generic/fcntl.h | 15 +++++++++++++++
> >  2 files changed, 36 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/locks.c b/fs/locks.c
> > index 86cafc3..3b278a6 100644
> > --- a/fs/locks.c
> > +++ b/fs/locks.c
> > @@ -348,6 +348,26 @@ static int posix_assign_type(struct file_lock *fl, long type)
> >  {
> >  	int err;
> >  
> > +	/*
> > +	 * FL_FILP_PRIVATE locks are "owned" by the filp upon which they were
> > +	 * acquired, regardless of what task is dealing with them. Set the
> > +	 * fl_owner appropriately.
> > +	 */
> > +	switch (type) {
> > +	case F_RDLCKP:
> > +		type = F_RDLCK;
> > +		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > +		break;
> > +	case F_WRLCKP:
> > +		type = F_WRLCK;
> > +		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > +		break;
> > +	case F_UNLCKP:
> > +		type = F_UNLCK;
> > +		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > +		break;
> > +	}
> > +
> 
> After this fl_owner gets set to current->files in
> flock{64}_to_posix_lock and then reset here.  That seems like a trap for
> the unwary reader.
> 
> Could you do something like rename this flock_to_posix_lock_common and
> move all the 32/64-bit-independent initialization here?
> 
> Looks like there's way more duplication than necessary between those two
> cases.
> 

Good point. I'll look at doing some more cleanup in that direction on
the next set.

> (Also, why do we have an fl_owner_t instead of using a void?)
> 

Another good point. As far as I can tell nothing uses fl_owner for
anything but a generic ownership "cookie". The pointer is never
actually dereferenced to get back to a files_struct, so a void pointer
(or even an unsigned long) would make more sense there.

I'll look at that before sending out the next version of this.

Thanks,

> 
> >  	err = assign_type(fl, type);
> >  	if (err)
> >  		return err;
> > @@ -2225,7 +2245,7 @@ void locks_remove_filp(struct file *filp)
> >  
> >  	while ((fl = *before) != NULL) {
> >  		if (fl->fl_file == filp) {
> > -			if (IS_FLOCK(fl)) {
> > +			if (IS_FLOCK(fl) || IS_POSIX(fl)) {
> >  				locks_delete_lock(before);
> >  				continue;
> >  			}
> > diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
> > index 95e46c8..6b7b68a 100644
> > --- a/include/uapi/asm-generic/fcntl.h
> > +++ b/include/uapi/asm-generic/fcntl.h
> > @@ -151,6 +151,21 @@ struct f_owner_ex {
> >  #define F_UNLCK		2
> >  #endif
> >  
> > +/*
> > + * fd "private" POSIX locks.
> > + *
> > + * Usually POSIX locks held by a process are released on *any* close and are
> > + * not inherited across a fork().
> > + *
> > + * These lock types will conflict with normal POSIX locks, but are "owned"
> > + * by the fd, not the process. This means that they are inherited across
> > + * fork() like BSD (flock) locks, and they are only closed when the last
> > + * reference to the the filp against which were acquired is closed.
> > + */
> > +#define F_RDLCKP	5
> > +#define F_WRLCKP	6
> > +#define F_UNLCKP	7
> > +
> >  /* for old implementation of bsd flock () */
> >  #ifndef F_EXLCK
> >  #define F_EXLCK		4	/* or 3 */
> > -- 
> > 1.8.3.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Jeff Layton <jlayton@redhat.com>

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

* Re: [RFC PATCH v2 4/5] locks: show private lock types in /proc/locks
  2013-11-20 16:45 ` [RFC PATCH v2 4/5] locks: show private lock types in /proc/locks Jeff Layton
@ 2013-11-20 20:00   ` J. Bruce Fields
  2013-11-20 20:03     ` Jeff Layton
  2013-11-20 20:04     ` J. Bruce Fields
  0 siblings, 2 replies; 18+ messages in thread
From: J. Bruce Fields @ 2013-11-20 20:00 UTC (permalink / raw)
  To: Jeff Layton
  Cc: linux-fsdevel, linux-kernel, nfs-ganesha-devel, samba-technical

On Wed, Nov 20, 2013 at 11:45:05AM -0500, Jeff Layton wrote:
> Show "private" locks in /proc/locks with a 'P' suffix. This does mean
> that we need to widen the column by one character.
> 
> Also, tighten up the check in locks_remove_filp() to ensure that only
> IS_FILP_PVT locks are removed there.

So that part belongs in the previous patch?

--b.

> 
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/locks.c         | 15 +++++++++++----
>  include/linux/fs.h |  1 +
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/locks.c b/fs/locks.c
> index 3b278a6..d5fb853 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -135,6 +135,7 @@
>  #define IS_POSIX(fl)	(fl->fl_flags & FL_POSIX)
>  #define IS_FLOCK(fl)	(fl->fl_flags & FL_FLOCK)
>  #define IS_LEASE(fl)	(fl->fl_flags & (FL_LEASE|FL_DELEG))
> +#define IS_FILP_PVT(fl)	(fl->fl_flags & FL_FILP_PRIVATE)
>  
>  static bool lease_breaking(struct file_lock *fl)
>  {
> @@ -357,14 +358,17 @@ static int posix_assign_type(struct file_lock *fl, long type)
>  	case F_RDLCKP:
>  		type = F_RDLCK;
>  		fl->fl_owner = (fl_owner_t)fl->fl_file;
> +		fl->fl_flags |= FL_FILP_PRIVATE;
>  		break;
>  	case F_WRLCKP:
>  		type = F_WRLCK;
>  		fl->fl_owner = (fl_owner_t)fl->fl_file;
> +		fl->fl_flags |= FL_FILP_PRIVATE;
>  		break;
>  	case F_UNLCKP:
>  		type = F_UNLCK;
>  		fl->fl_owner = (fl_owner_t)fl->fl_file;
> +		fl->fl_flags |= FL_FILP_PRIVATE;
>  		break;
>  	}
>  
> @@ -2245,7 +2249,8 @@ void locks_remove_filp(struct file *filp)
>  
>  	while ((fl = *before) != NULL) {
>  		if (fl->fl_file == filp) {
> -			if (IS_FLOCK(fl) || IS_POSIX(fl)) {
> +			if (IS_FLOCK(fl) ||
> +			    (IS_POSIX(fl) && IS_FILP_PVT(fl))) {
>  				locks_delete_lock(before);
>  				continue;
>  			}
> @@ -2345,13 +2350,15 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
>  		seq_printf(f, "UNKNOWN UNKNOWN  ");
>  	}
>  	if (fl->fl_type & LOCK_MAND) {
> -		seq_printf(f, "%s ",
> +		seq_printf(f, "%s  ",
>  			       (fl->fl_type & LOCK_READ)
>  			       ? (fl->fl_type & LOCK_WRITE) ? "RW   " : "READ "
>  			       : (fl->fl_type & LOCK_WRITE) ? "WRITE" : "NONE ");
> +	} else if (IS_FILP_PVT(fl)) {
> +		seq_printf(f, "%s ", fl->fl_type == F_WRLCK ?  "WRITEP" : "READP ");
>  	} else {
> -		seq_printf(f, "%s ",
> -			       (lease_breaking(fl))
> +		seq_printf(f, "%s  ",
> +			       lease_breaking(fl)
>  			       ? (fl->fl_type == F_UNLCK) ? "UNLCK" : "READ "
>  			       : (fl->fl_type == F_WRLCK) ? "WRITE" : "READ ");
>  	}
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 2d890ce..9890bac 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -888,6 +888,7 @@ static inline int file_check_writeable(struct file *filp)
>  #define FL_SLEEP	128	/* A blocking lock */
>  #define FL_DOWNGRADE_PENDING	256 /* Lease is being downgraded */
>  #define FL_UNLOCK_PENDING	512 /* Lease is being broken */
> +#define FL_FILP_PRIVATE	1024	/* lock is private to the filp */
>  
>  /*
>   * Special return value from posix_lock_file() and vfs_lock_file() for
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" 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] 18+ messages in thread

* Re: [RFC PATCH v2 4/5] locks: show private lock types in /proc/locks
  2013-11-20 20:00   ` J. Bruce Fields
@ 2013-11-20 20:03     ` Jeff Layton
  2013-11-20 20:04     ` J. Bruce Fields
  1 sibling, 0 replies; 18+ messages in thread
From: Jeff Layton @ 2013-11-20 20:03 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: linux-fsdevel, linux-kernel, nfs-ganesha-devel, samba-technical

On Wed, 20 Nov 2013 15:00:56 -0500
"J. Bruce Fields" <bfields@fieldses.org> wrote:

> On Wed, Nov 20, 2013 at 11:45:05AM -0500, Jeff Layton wrote:
> > Show "private" locks in /proc/locks with a 'P' suffix. This does mean
> > that we need to widen the column by one character.
> > 
> > Also, tighten up the check in locks_remove_filp() to ensure that only
> > IS_FILP_PVT locks are removed there.
> 
> So that part belongs in the previous patch?
> 
> --b.
> 

Well, it's not technically broken with it in this patch. The code
should still basically work, but yeah it probably makes some sense to
move that part into the previous patch. I'll fix in that in the next
version.

Thanks,

> > 
> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > ---
> >  fs/locks.c         | 15 +++++++++++----
> >  include/linux/fs.h |  1 +
> >  2 files changed, 12 insertions(+), 4 deletions(-)
> > 
> > diff --git a/fs/locks.c b/fs/locks.c
> > index 3b278a6..d5fb853 100644
> > --- a/fs/locks.c
> > +++ b/fs/locks.c
> > @@ -135,6 +135,7 @@
> >  #define IS_POSIX(fl)	(fl->fl_flags & FL_POSIX)
> >  #define IS_FLOCK(fl)	(fl->fl_flags & FL_FLOCK)
> >  #define IS_LEASE(fl)	(fl->fl_flags & (FL_LEASE|FL_DELEG))
> > +#define IS_FILP_PVT(fl)	(fl->fl_flags & FL_FILP_PRIVATE)
> >  
> >  static bool lease_breaking(struct file_lock *fl)
> >  {
> > @@ -357,14 +358,17 @@ static int posix_assign_type(struct file_lock *fl, long type)
> >  	case F_RDLCKP:
> >  		type = F_RDLCK;
> >  		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > +		fl->fl_flags |= FL_FILP_PRIVATE;
> >  		break;
> >  	case F_WRLCKP:
> >  		type = F_WRLCK;
> >  		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > +		fl->fl_flags |= FL_FILP_PRIVATE;
> >  		break;
> >  	case F_UNLCKP:
> >  		type = F_UNLCK;
> >  		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > +		fl->fl_flags |= FL_FILP_PRIVATE;
> >  		break;
> >  	}
> >  
> > @@ -2245,7 +2249,8 @@ void locks_remove_filp(struct file *filp)
> >  
> >  	while ((fl = *before) != NULL) {
> >  		if (fl->fl_file == filp) {
> > -			if (IS_FLOCK(fl) || IS_POSIX(fl)) {
> > +			if (IS_FLOCK(fl) ||
> > +			    (IS_POSIX(fl) && IS_FILP_PVT(fl))) {
> >  				locks_delete_lock(before);
> >  				continue;
> >  			}
> > @@ -2345,13 +2350,15 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
> >  		seq_printf(f, "UNKNOWN UNKNOWN  ");
> >  	}
> >  	if (fl->fl_type & LOCK_MAND) {
> > -		seq_printf(f, "%s ",
> > +		seq_printf(f, "%s  ",
> >  			       (fl->fl_type & LOCK_READ)
> >  			       ? (fl->fl_type & LOCK_WRITE) ? "RW   " : "READ "
> >  			       : (fl->fl_type & LOCK_WRITE) ? "WRITE" : "NONE ");
> > +	} else if (IS_FILP_PVT(fl)) {
> > +		seq_printf(f, "%s ", fl->fl_type == F_WRLCK ?  "WRITEP" : "READP ");
> >  	} else {
> > -		seq_printf(f, "%s ",
> > -			       (lease_breaking(fl))
> > +		seq_printf(f, "%s  ",
> > +			       lease_breaking(fl)
> >  			       ? (fl->fl_type == F_UNLCK) ? "UNLCK" : "READ "
> >  			       : (fl->fl_type == F_WRLCK) ? "WRITE" : "READ ");
> >  	}
> > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > index 2d890ce..9890bac 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -888,6 +888,7 @@ static inline int file_check_writeable(struct file *filp)
> >  #define FL_SLEEP	128	/* A blocking lock */
> >  #define FL_DOWNGRADE_PENDING	256 /* Lease is being downgraded */
> >  #define FL_UNLOCK_PENDING	512 /* Lease is being broken */
> > +#define FL_FILP_PRIVATE	1024	/* lock is private to the filp */
> >  
> >  /*
> >   * Special return value from posix_lock_file() and vfs_lock_file() for
> > -- 
> > 1.8.3.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html


-- 
Jeff Layton <jlayton@redhat.com>

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

* Re: [RFC PATCH v2 4/5] locks: show private lock types in /proc/locks
  2013-11-20 20:00   ` J. Bruce Fields
  2013-11-20 20:03     ` Jeff Layton
@ 2013-11-20 20:04     ` J. Bruce Fields
  1 sibling, 0 replies; 18+ messages in thread
From: J. Bruce Fields @ 2013-11-20 20:04 UTC (permalink / raw)
  To: Jeff Layton
  Cc: linux-fsdevel, linux-kernel, nfs-ganesha-devel, samba-technical

On Wed, Nov 20, 2013 at 03:00:56PM -0500, bfields wrote:
> On Wed, Nov 20, 2013 at 11:45:05AM -0500, Jeff Layton wrote:
> > Show "private" locks in /proc/locks with a 'P' suffix. This does mean
> > that we need to widen the column by one character.
> > 
> > Also, tighten up the check in locks_remove_filp() to ensure that only
> > IS_FILP_PVT locks are removed there.
> 
> So that part belongs in the previous patch?

I think it's that previous patch that actually "turns on" the new user
interface (so after that patch userspace will get a lock instead of
-EINVAL or whatever).

Might be safest to delay doing that until the end of the series so as
not to expose any partial implementation.

--b.

> 
> --b.
> 
> > 
> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > ---
> >  fs/locks.c         | 15 +++++++++++----
> >  include/linux/fs.h |  1 +
> >  2 files changed, 12 insertions(+), 4 deletions(-)
> > 
> > diff --git a/fs/locks.c b/fs/locks.c
> > index 3b278a6..d5fb853 100644
> > --- a/fs/locks.c
> > +++ b/fs/locks.c
> > @@ -135,6 +135,7 @@
> >  #define IS_POSIX(fl)	(fl->fl_flags & FL_POSIX)
> >  #define IS_FLOCK(fl)	(fl->fl_flags & FL_FLOCK)
> >  #define IS_LEASE(fl)	(fl->fl_flags & (FL_LEASE|FL_DELEG))
> > +#define IS_FILP_PVT(fl)	(fl->fl_flags & FL_FILP_PRIVATE)
> >  
> >  static bool lease_breaking(struct file_lock *fl)
> >  {
> > @@ -357,14 +358,17 @@ static int posix_assign_type(struct file_lock *fl, long type)
> >  	case F_RDLCKP:
> >  		type = F_RDLCK;
> >  		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > +		fl->fl_flags |= FL_FILP_PRIVATE;
> >  		break;
> >  	case F_WRLCKP:
> >  		type = F_WRLCK;
> >  		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > +		fl->fl_flags |= FL_FILP_PRIVATE;
> >  		break;
> >  	case F_UNLCKP:
> >  		type = F_UNLCK;
> >  		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > +		fl->fl_flags |= FL_FILP_PRIVATE;
> >  		break;
> >  	}
> >  
> > @@ -2245,7 +2249,8 @@ void locks_remove_filp(struct file *filp)
> >  
> >  	while ((fl = *before) != NULL) {
> >  		if (fl->fl_file == filp) {
> > -			if (IS_FLOCK(fl) || IS_POSIX(fl)) {
> > +			if (IS_FLOCK(fl) ||
> > +			    (IS_POSIX(fl) && IS_FILP_PVT(fl))) {
> >  				locks_delete_lock(before);
> >  				continue;
> >  			}
> > @@ -2345,13 +2350,15 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
> >  		seq_printf(f, "UNKNOWN UNKNOWN  ");
> >  	}
> >  	if (fl->fl_type & LOCK_MAND) {
> > -		seq_printf(f, "%s ",
> > +		seq_printf(f, "%s  ",
> >  			       (fl->fl_type & LOCK_READ)
> >  			       ? (fl->fl_type & LOCK_WRITE) ? "RW   " : "READ "
> >  			       : (fl->fl_type & LOCK_WRITE) ? "WRITE" : "NONE ");
> > +	} else if (IS_FILP_PVT(fl)) {
> > +		seq_printf(f, "%s ", fl->fl_type == F_WRLCK ?  "WRITEP" : "READP ");
> >  	} else {
> > -		seq_printf(f, "%s ",
> > -			       (lease_breaking(fl))
> > +		seq_printf(f, "%s  ",
> > +			       lease_breaking(fl)
> >  			       ? (fl->fl_type == F_UNLCK) ? "UNLCK" : "READ "
> >  			       : (fl->fl_type == F_WRLCK) ? "WRITE" : "READ ");
> >  	}
> > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > index 2d890ce..9890bac 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -888,6 +888,7 @@ static inline int file_check_writeable(struct file *filp)
> >  #define FL_SLEEP	128	/* A blocking lock */
> >  #define FL_DOWNGRADE_PENDING	256 /* Lease is being downgraded */
> >  #define FL_UNLOCK_PENDING	512 /* Lease is being broken */
> > +#define FL_FILP_PRIVATE	1024	/* lock is private to the filp */
> >  
> >  /*
> >   * Special return value from posix_lock_file() and vfs_lock_file() for
> > -- 
> > 1.8.3.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" 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] 18+ messages in thread

* Re: [RFC PATCH v2 1/5] locks: consolidate checks for compatible filp->f_mode values in setlk handlers
  2013-11-20 16:45 ` [RFC PATCH v2 1/5] locks: consolidate checks for compatible filp->f_mode values in setlk handlers Jeff Layton
@ 2013-11-21 17:35   ` Christoph Hellwig
  0 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2013-11-21 17:35 UTC (permalink / raw)
  To: Jeff Layton
  Cc: linux-fsdevel, linux-kernel, nfs-ganesha-devel, samba-technical

On Wed, Nov 20, 2013 at 11:45:02AM -0500, Jeff Layton wrote:
> Add a wrapper around assign_type that does this instead of duplicating
> this check in two places. This also fixes a minor wart in the code where
> we continue referring to the struct flock after converting it to struct
> file_lock.

I don't think posix_assign_type is a good name for this helper, but
as Bruce already pointed out more work is required in that area anyway.


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

* Re: [RFC PATCH v2 2/5] locks: rename locks_remove_flock to locks_remove_filp
  2013-11-20 16:45 ` [RFC PATCH v2 2/5] locks: rename locks_remove_flock to locks_remove_filp Jeff Layton
@ 2013-11-21 17:35   ` Christoph Hellwig
  0 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2013-11-21 17:35 UTC (permalink / raw)
  To: Jeff Layton
  Cc: linux-fsdevel, linux-kernel, nfs-ganesha-devel, samba-technical

On Wed, Nov 20, 2013 at 11:45:03AM -0500, Jeff Layton wrote:
> This function currently removes leases in addition to flock locks, so
> the name is misleading. Rename it to locks_remove_filp to indicate that
> it removes locks that are associated with a particular filp.

s/filp/file/ please.


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

* Re: [RFC PATCH v2 3/5] locks: add new "private" lock type that is owned by the filp
  2013-11-20 16:45 ` [RFC PATCH v2 3/5] locks: add new "private" lock type that is owned by the filp Jeff Layton
  2013-11-20 19:50   ` J. Bruce Fields
@ 2013-11-21 17:36   ` Christoph Hellwig
  1 sibling, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2013-11-21 17:36 UTC (permalink / raw)
  To: Jeff Layton
  Cc: linux-fsdevel, linux-kernel, nfs-ganesha-devel, samba-technical

s/FILP/FILE/


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

* Re: [Nfs-ganesha-devel] [RFC PATCH v2 3/5] locks: add new "private" lock type that is owned by the filp
  2013-11-20 19:50   ` J. Bruce Fields
  2013-11-20 20:00     ` Jeff Layton
@ 2013-12-09 16:46     ` Jeff Layton
  2013-12-10 20:35       ` J. Bruce Fields
  1 sibling, 1 reply; 18+ messages in thread
From: Jeff Layton @ 2013-12-09 16:46 UTC (permalink / raw)
  To: J. Bruce Fields
  Cc: linux-fsdevel, nfs-ganesha-devel, samba-technical, linux-kernel

On Wed, 20 Nov 2013 14:50:32 -0500
"J. Bruce Fields" <bfields@fieldses.org> wrote:

> On Wed, Nov 20, 2013 at 11:45:04AM -0500, Jeff Layton wrote:
> > Due to some unfortunate history, POSIX locks have very strange and
> > unhelpful semantics. The thing that usually catches people by surprise
> > is that they are dropped whenever the process closes any file descriptor
> > associated with the inode.
> > 
> > This is extremely problematic for people developing file servers that
> > need to implement byte-range locks. Developers often need a "lock
> > management" facility to ensure that file descriptors are not closed
> > until all of the locks associated with the inode are finished.
> > 
> > This patchset adds a new type of lock that attempts to address this
> > issue. These locks work just like "normal" POSIX read/write locks, but
> > have semantics that are more like BSD locks with respect to inheritance
> > and behavior on close.
> > 
> > This is implemented primarily by changing how fl_owner field is set for
> > these locks. Instead of having them owned by the files_struct of the
> > process, they are instead owned by the filp on which they were acquired.
> > Thus, they are inherited across fork() and are only released when the
> > last reference to a filp is put.
> > 
> > These new semantics prevent them from being merged with "classic" POSIX
> > locks, even if they are acquired by the same process. These locks will
> > also conflict with "classic" POSIX locks even if they are acquired by
> > the same process or on the same file descriptor.
> > 
> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > ---
> >  fs/locks.c                       | 22 +++++++++++++++++++++-
> >  include/uapi/asm-generic/fcntl.h | 15 +++++++++++++++
> >  2 files changed, 36 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/locks.c b/fs/locks.c
> > index 86cafc3..3b278a6 100644
> > --- a/fs/locks.c
> > +++ b/fs/locks.c
> > @@ -348,6 +348,26 @@ static int posix_assign_type(struct file_lock *fl, long type)
> >  {
> >  	int err;
> >  
> > +	/*
> > +	 * FL_FILP_PRIVATE locks are "owned" by the filp upon which they were
> > +	 * acquired, regardless of what task is dealing with them. Set the
> > +	 * fl_owner appropriately.
> > +	 */
> > +	switch (type) {
> > +	case F_RDLCKP:
> > +		type = F_RDLCK;
> > +		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > +		break;
> > +	case F_WRLCKP:
> > +		type = F_WRLCK;
> > +		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > +		break;
> > +	case F_UNLCKP:
> > +		type = F_UNLCK;
> > +		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > +		break;
> > +	}
> > +
> 
> After this fl_owner gets set to current->files in
> flock{64}_to_posix_lock and then reset here.  That seems like a trap for
> the unwary reader.
> 
> Could you do something like rename this flock_to_posix_lock_common and
> move all the 32/64-bit-independent initialization here?
> 
> Looks like there's way more duplication than necessary between those two
> cases.
> 

Ok, finally got a chance to start looking at this again...

I agree that at first glance, it looks like there is a lot of
duplication between flock_to_posix_lock and flock64_to_posix_lock, but
the problem we have is that we need to initialize the file_locks with
info from two different types of structs that were passed in from
userland (flock and flock64).

I don't see a clean way to consolidate the two given that...

> (Also, why do we have an fl_owner_t instead of using a void?)
> 
> --b.
> 
> >  	err = assign_type(fl, type);
> >  	if (err)
> >  		return err;
> > @@ -2225,7 +2245,7 @@ void locks_remove_filp(struct file *filp)
> >  
> >  	while ((fl = *before) != NULL) {
> >  		if (fl->fl_file == filp) {
> > -			if (IS_FLOCK(fl)) {
> > +			if (IS_FLOCK(fl) || IS_POSIX(fl)) {
> >  				locks_delete_lock(before);
> >  				continue;
> >  			}
> > diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
> > index 95e46c8..6b7b68a 100644
> > --- a/include/uapi/asm-generic/fcntl.h
> > +++ b/include/uapi/asm-generic/fcntl.h
> > @@ -151,6 +151,21 @@ struct f_owner_ex {
> >  #define F_UNLCK		2
> >  #endif
> >  
> > +/*
> > + * fd "private" POSIX locks.
> > + *
> > + * Usually POSIX locks held by a process are released on *any* close and are
> > + * not inherited across a fork().
> > + *
> > + * These lock types will conflict with normal POSIX locks, but are "owned"
> > + * by the fd, not the process. This means that they are inherited across
> > + * fork() like BSD (flock) locks, and they are only closed when the last
> > + * reference to the the filp against which were acquired is closed.
> > + */
> > +#define F_RDLCKP	5
> > +#define F_WRLCKP	6
> > +#define F_UNLCKP	7
> > +
> >  /* for old implementation of bsd flock () */
> >  #ifndef F_EXLCK
> >  #define F_EXLCK		4	/* or 3 */
> > -- 
> > 1.8.3.1
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> ------------------------------------------------------------------------------
> Shape the Mobile Experience: Free Subscription
> Software experts and developers: Be at the forefront of tech innovation.
> Intel(R) Software Adrenaline delivers strategic insight and game-changing 
> conversations that shape the rapidly evolving mobile landscape. Sign up now. 
> http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
> _______________________________________________
> Nfs-ganesha-devel mailing list
> Nfs-ganesha-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel


-- 
Jeff Layton <jlayton@redhat.com>

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

* Re: [Nfs-ganesha-devel] [RFC PATCH v2 3/5] locks: add new "private" lock type that is owned by the filp
  2013-12-09 16:46     ` [Nfs-ganesha-devel] " Jeff Layton
@ 2013-12-10 20:35       ` J. Bruce Fields
  0 siblings, 0 replies; 18+ messages in thread
From: J. Bruce Fields @ 2013-12-10 20:35 UTC (permalink / raw)
  To: Jeff Layton
  Cc: linux-fsdevel, nfs-ganesha-devel, samba-technical, linux-kernel

On Mon, Dec 09, 2013 at 11:46:53AM -0500, Jeff Layton wrote:
> On Wed, 20 Nov 2013 14:50:32 -0500
> "J. Bruce Fields" <bfields@fieldses.org> wrote:
> 
> > On Wed, Nov 20, 2013 at 11:45:04AM -0500, Jeff Layton wrote:
> > > Due to some unfortunate history, POSIX locks have very strange and
> > > unhelpful semantics. The thing that usually catches people by surprise
> > > is that they are dropped whenever the process closes any file descriptor
> > > associated with the inode.
> > > 
> > > This is extremely problematic for people developing file servers that
> > > need to implement byte-range locks. Developers often need a "lock
> > > management" facility to ensure that file descriptors are not closed
> > > until all of the locks associated with the inode are finished.
> > > 
> > > This patchset adds a new type of lock that attempts to address this
> > > issue. These locks work just like "normal" POSIX read/write locks, but
> > > have semantics that are more like BSD locks with respect to inheritance
> > > and behavior on close.
> > > 
> > > This is implemented primarily by changing how fl_owner field is set for
> > > these locks. Instead of having them owned by the files_struct of the
> > > process, they are instead owned by the filp on which they were acquired.
> > > Thus, they are inherited across fork() and are only released when the
> > > last reference to a filp is put.
> > > 
> > > These new semantics prevent them from being merged with "classic" POSIX
> > > locks, even if they are acquired by the same process. These locks will
> > > also conflict with "classic" POSIX locks even if they are acquired by
> > > the same process or on the same file descriptor.
> > > 
> > > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > > ---
> > >  fs/locks.c                       | 22 +++++++++++++++++++++-
> > >  include/uapi/asm-generic/fcntl.h | 15 +++++++++++++++
> > >  2 files changed, 36 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/fs/locks.c b/fs/locks.c
> > > index 86cafc3..3b278a6 100644
> > > --- a/fs/locks.c
> > > +++ b/fs/locks.c
> > > @@ -348,6 +348,26 @@ static int posix_assign_type(struct file_lock *fl, long type)
> > >  {
> > >  	int err;
> > >  
> > > +	/*
> > > +	 * FL_FILP_PRIVATE locks are "owned" by the filp upon which they were
> > > +	 * acquired, regardless of what task is dealing with them. Set the
> > > +	 * fl_owner appropriately.
> > > +	 */
> > > +	switch (type) {
> > > +	case F_RDLCKP:
> > > +		type = F_RDLCK;
> > > +		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > > +		break;
> > > +	case F_WRLCKP:
> > > +		type = F_WRLCK;
> > > +		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > > +		break;
> > > +	case F_UNLCKP:
> > > +		type = F_UNLCK;
> > > +		fl->fl_owner = (fl_owner_t)fl->fl_file;
> > > +		break;
> > > +	}
> > > +
> > 
> > After this fl_owner gets set to current->files in
> > flock{64}_to_posix_lock and then reset here.  That seems like a trap for
> > the unwary reader.
> > 
> > Could you do something like rename this flock_to_posix_lock_common and
> > move all the 32/64-bit-independent initialization here?
> > 
> > Looks like there's way more duplication than necessary between those two
> > cases.
> > 
> 
> Ok, finally got a chance to start looking at this again...
> 
> I agree that at first glance, it looks like there is a lot of
> duplication between flock_to_posix_lock and flock64_to_posix_lock, but
> the problem we have is that we need to initialize the file_locks with
> info from two different types of structs that were passed in from
> userland (flock and flock64).
> 
> I don't see a clean way to consolidate the two given that...

Doh, yes I overlooked that.  Still seems like there should be more to
do, but let me go look at your revised series....

--b.

> 
> > (Also, why do we have an fl_owner_t instead of using a void?)
> > 
> > --b.
> > 
> > >  	err = assign_type(fl, type);
> > >  	if (err)
> > >  		return err;
> > > @@ -2225,7 +2245,7 @@ void locks_remove_filp(struct file *filp)
> > >  
> > >  	while ((fl = *before) != NULL) {
> > >  		if (fl->fl_file == filp) {
> > > -			if (IS_FLOCK(fl)) {
> > > +			if (IS_FLOCK(fl) || IS_POSIX(fl)) {
> > >  				locks_delete_lock(before);
> > >  				continue;
> > >  			}
> > > diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
> > > index 95e46c8..6b7b68a 100644
> > > --- a/include/uapi/asm-generic/fcntl.h
> > > +++ b/include/uapi/asm-generic/fcntl.h
> > > @@ -151,6 +151,21 @@ struct f_owner_ex {
> > >  #define F_UNLCK		2
> > >  #endif
> > >  
> > > +/*
> > > + * fd "private" POSIX locks.
> > > + *
> > > + * Usually POSIX locks held by a process are released on *any* close and are
> > > + * not inherited across a fork().
> > > + *
> > > + * These lock types will conflict with normal POSIX locks, but are "owned"
> > > + * by the fd, not the process. This means that they are inherited across
> > > + * fork() like BSD (flock) locks, and they are only closed when the last
> > > + * reference to the the filp against which were acquired is closed.
> > > + */
> > > +#define F_RDLCKP	5
> > > +#define F_WRLCKP	6
> > > +#define F_UNLCKP	7
> > > +
> > >  /* for old implementation of bsd flock () */
> > >  #ifndef F_EXLCK
> > >  #define F_EXLCK		4	/* or 3 */
> > > -- 
> > > 1.8.3.1
> > > 
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> > ------------------------------------------------------------------------------
> > Shape the Mobile Experience: Free Subscription
> > Software experts and developers: Be at the forefront of tech innovation.
> > Intel(R) Software Adrenaline delivers strategic insight and game-changing 
> > conversations that shape the rapidly evolving mobile landscape. Sign up now. 
> > http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Nfs-ganesha-devel mailing list
> > Nfs-ganesha-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel
> 
> 
> -- 
> Jeff Layton <jlayton@redhat.com>

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

end of thread, other threads:[~2013-12-10 20:35 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-20 16:45 [RFC PATCH v2 0/5] locks: implement "filp-private" (aka UNPOSIX) locks Jeff Layton
2013-11-20 16:45 ` [RFC PATCH v2 1/5] locks: consolidate checks for compatible filp->f_mode values in setlk handlers Jeff Layton
2013-11-21 17:35   ` Christoph Hellwig
2013-11-20 16:45 ` [RFC PATCH v2 2/5] locks: rename locks_remove_flock to locks_remove_filp Jeff Layton
2013-11-21 17:35   ` Christoph Hellwig
2013-11-20 16:45 ` [RFC PATCH v2 3/5] locks: add new "private" lock type that is owned by the filp Jeff Layton
2013-11-20 19:50   ` J. Bruce Fields
2013-11-20 20:00     ` Jeff Layton
2013-12-09 16:46     ` [Nfs-ganesha-devel] " Jeff Layton
2013-12-10 20:35       ` J. Bruce Fields
2013-11-21 17:36   ` Christoph Hellwig
2013-11-20 16:45 ` [RFC PATCH v2 4/5] locks: show private lock types in /proc/locks Jeff Layton
2013-11-20 20:00   ` J. Bruce Fields
2013-11-20 20:03     ` Jeff Layton
2013-11-20 20:04     ` J. Bruce Fields
2013-11-20 16:45 ` [RFC PATCH v2 5/5] locks: report l_pid as -1 for FL_FILP_PRIVATE locks Jeff Layton
2013-11-20 17:55   ` Frank Filz
2013-11-20 18:57     ` Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).