From mboxrd@z Thu Jan 1 00:00:00 1970 From: Trond Myklebust Subject: Re: [PATCH] locks: provide a file lease method enabling cluster-coherent leases Date: Thu, 31 May 2007 18:34:09 -0400 Message-ID: <1180650849.7084.19.camel@heimdal.trondhjem.org> References: <1180647624483-git-send-email-bfields@fieldses.org> <11806476252240-git-send-email-bfields@fieldses.org> <11806476252913-git-send-email-bfields@fieldses.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Cc: linux-fsdevel@vger.kernel.org, nfs@lists.sourceforge.net, "J. Bruce Fields" , David Teigland , Marc Eshel To: "J. Bruce Fields" Return-path: Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92] helo=mail.sourceforge.net) by sc8-sf-list2-new.sourceforge.net with esmtp (Exim 4.43) id 1HttDu-0005ly-6n for nfs@lists.sourceforge.net; Thu, 31 May 2007 15:34:26 -0700 Received: from pat.uio.no ([129.240.10.15]) by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.44) id 1HttDv-0006KW-Ms for nfs@lists.sourceforge.net; Thu, 31 May 2007 15:34:29 -0700 In-Reply-To: <11806476252913-git-send-email-bfields@fieldses.org> List-Id: "Discussion of NFS under Linux development, interoperability, and testing." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: nfs-bounces@lists.sourceforge.net Errors-To: nfs-bounces@lists.sourceforge.net On Thu, 2007-05-31 at 17:40 -0400, J. Bruce Fields wrote: > From: J. Bruce Fields > > 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 > --- > 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); Splitting the lease into a file_operation part and an inode_operation part looks really ugly. It also means that you're calling twice down into the filesystem for every call to may_open() (once for vfs_permission() and once for break_lease()) and 3 times in do_sys_truncate(). Would it perhaps make sense to package up the call to vfs_permission() and break_lease() as a single 'may_open()' inode operation that could be called by may_open(), do_sys_truncate() and nfsd? Trond ------------------------------------------------------------------------- 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