All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: linux-fsdevel@vger.kernel.org
Cc: "J. Bruce Fields" <bfields@fieldses.org>,
	David Teigland <teigland@redhat.com>,
	"J. Bruce Fields" <bfields@citi.umich.edu>,
	nfs@lists.sourceforge.net, Marc Eshel <eshel@almaden.ibm.com>
Subject: [PATCH] locks: provide a file lease method enabling cluster-coherent leases
Date: Thu, 31 May 2007 17:40:23 -0400	[thread overview]
Message-ID: <11806476252913-git-send-email-bfields@fieldses.org> (raw)
In-Reply-To: <11806476252240-git-send-email-bfields@fieldses.org>

From: J. Bruce Fields <bfields@fieldses.org>

Currently leases are only kept locally, so there's no way for a distributed
filesystem to enforce them against multiple clients.  We're particularly
interested in the case of nfsd exporting a cluster filesystem, in which
case nfsd needs cluster-coherent leases in order to implement delegations
correctly.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
---
 fs/locks.c         |    5 ++++-
 include/linux/fs.h |    4 ++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 3f366e1..40a7f39 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1444,7 +1444,10 @@ int setlease(struct file *filp, long arg, struct file_lock **lease)
 		return error;
 
 	lock_kernel();
-	error = __setlease(filp, arg, lease);
+	if (filp->f_op && filp->f_op->set_lease)
+		error = filp->f_op->set_lease(filp, arg, lease);
+        else
+		error = __setlease(filp, arg, lease);
 	unlock_kernel();
 
 	return error;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7cf0c54..09aefb4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1112,6 +1112,7 @@ struct file_operations {
 	int (*flock) (struct file *, int, struct file_lock *);
 	ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);
 	ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);
+	int (*set_lease)(struct file *, long, struct file_lock **);
 };
 
 struct inode_operations {
@@ -1137,6 +1138,7 @@ struct inode_operations {
 	ssize_t (*listxattr) (struct dentry *, char *, size_t);
 	int (*removexattr) (struct dentry *, const char *);
 	void (*truncate_range)(struct inode *, loff_t, loff_t);
+	int (*break_lease)(struct inode *, unsigned int);
 };
 
 struct seq_file;
@@ -1463,6 +1465,8 @@ static inline int locks_verify_truncate(struct inode *inode,
 
 static inline int break_lease(struct inode *inode, unsigned int mode)
 {
+	if (inode->i_op && inode->i_op->break_lease)
+		return inode->i_op->break_lease(inode, mode);
 	if (inode->i_flock)
 		return __break_lease(inode, mode);
 	return 0;
-- 
1.5.2.rc3


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

  reply	other threads:[~2007-05-31 21:40 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-31 21:40 cluster-coherent leases J. Bruce Fields
2007-05-31 21:40 ` [PATCH] locks: share more common lease code J. Bruce Fields
2007-05-31 21:40   ` J. Bruce Fields [this message]
2007-05-31 21:40     ` [PATCH] gfs2: stop giving out non-cluster-coherent leases J. Bruce Fields
2007-05-31 22:34     ` [PATCH] locks: provide a file lease method enabling cluster-coherent leases Trond Myklebust
2007-06-01 16:53       ` [NFS] " J. Bruce Fields
2007-06-02 17:39         ` Trond Myklebust
2007-06-02 18:09           ` Marc Eshel
2007-06-02 18:21             ` Trond Myklebust
2007-06-04 13:59               ` J. Bruce Fields
2007-06-05 22:04                 ` Robert Rappaport
2007-06-05 22:53                   ` [NFS] " Trond Myklebust
2007-06-05 22:56                   ` Marc Eshel
2007-06-05 23:40                     ` Trond Myklebust
2007-06-06 18:43                       ` Robert Rappaport
2007-06-07 14:43                         ` [NFS] " Robert Rappaport
2007-06-07 17:05                           ` J. Bruce Fields
2007-06-08 22:14                             ` (no subject) J. Bruce Fields
2007-06-08 22:14                             ` (unknown), J. Bruce Fields
     [not found]                             ` <11813408953536-git-send-email->
2007-06-08 22:14                               ` [PATCH 1/5] locks: share more common lease code J. Bruce Fields
2007-06-08 22:14                               ` J. Bruce Fields
     [not found]                               ` <11813408952518-git-send-email->
2007-06-08 22:14                                 ` [PATCH 2/5] locks: provide a file lease method enabling cluster-coherent leases J. Bruce Fields
2007-06-08 22:14                                 ` J. Bruce Fields
     [not found]                                 ` <11813408951909-git-send-email->
2007-06-08 22:14                                   ` [PATCH 3/5] locks: rename lease functions to reflect locks.c conventions J. Bruce Fields
2007-06-08 22:14                                   ` J. Bruce Fields
     [not found]                                   ` <11813408954053-git-send-email->
2007-06-08 22:14                                     ` [PATCH 4/5] gfs2: stop giving out non-cluster-coherent leases J. Bruce Fields
2007-06-08 22:14                                     ` J. Bruce Fields
     [not found]                                     ` <11813408951694-git-send-email->
2007-06-08 22:14                                       ` [PATCH 5/5] nfs: disable leases over NFS J. Bruce Fields
2007-06-08 22:14                                       ` J. Bruce Fields
2007-06-09 14:18                                       ` [PATCH 4/5] gfs2: stop giving out non-cluster-coherent leases Steven Whitehouse
2007-06-09 16:35                                         ` Marc Eshel
2007-06-11  9:38                                           ` Steven Whitehouse
2007-06-11 17:07                                             ` J. Bruce Fields
2007-06-09 16:56                                     ` [PATCH 3/5] locks: rename lease functions to reflect locks.c conventions Marc Eshel
2007-06-11 16:53                                       ` J. Bruce Fields
2007-06-02 18:23             ` [NFS] [PATCH] locks: provide a file lease method enabling cluster-coherent leases Trond Myklebust
2007-06-01 13:14     ` Peter Staubach
2007-06-01 16:44       ` [NFS] " J. Bruce Fields
2007-06-01 17:41         ` Matthew Wilcox
2007-06-01 18:08           ` J. Bruce Fields
2007-05-31 21:51   ` [PATCH] locks: share more common lease code Trond Myklebust
2007-06-01 16:30     ` [NFS] " J. Bruce Fields
2007-06-01 16:36       ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11806476252913-git-send-email-bfields@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=bfields@citi.umich.edu \
    --cc=eshel@almaden.ibm.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=nfs@lists.sourceforge.net \
    --cc=teigland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.