From: J. Bruce Fields <[EMAIL PROTECTED]>
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 <[EMAIL PROTECTED]>
---
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
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html