Commit:     370f6599e8bc03fd9fc6d1a1be00ae0c6373ca59
Parent:     60446067ba7a8e890a91db3b4a7436fe0ebd2dee
Author:     J. Bruce Fields <[EMAIL PROTECTED]>
AuthorDate: Fri Jun 8 15:23:34 2007 -0400
Committer:  J. Bruce Fields <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 19:17:19 2007 -0400

    nfs: disable leases over NFS
    As Peter Staubach says elsewhere
    > The problem is that some file system such as NFSv2 and NFSv3 do
    > not have sufficient support to be able to support leases correctly.
    > In particular for these two file systems, there is no over the wire
    > protocol support.
    > Currently, these two file systems fail the fcntl(F_SETLEASE) call
    > accidentally, due to a reference counting difference.  These file
    > systems should fail more consciously, with a proper error to
    > indicate that the call is invalid for them.
    Define an nfs setlease method that just returns -EINVAL.
    If someone can demonstrate a real need, perhaps we could reenable
    them in the presence of the "nolock" mount option.
    Signed-off-by: "J. Bruce Fields" <[EMAIL PROTECTED]>
    Cc: Peter Staubach <[EMAIL PROTECTED]>
    Cc: Trond Myklebust <[EMAIL PROTECTED]>
 fs/nfs/file.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 8689b73..13ac6fa 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -53,6 +53,7 @@ static int  nfs_fsync(struct file *, struct dentry *dentry, 
int datasync);
 static int nfs_check_flags(int flags);
 static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl);
 static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl);
+static int nfs_setlease(struct file *file, long arg, struct file_lock **fl);
 const struct file_operations nfs_file_operations = {
        .llseek         = nfs_file_llseek,
@@ -69,6 +70,7 @@ const struct file_operations nfs_file_operations = {
        .flock          = nfs_flock,
        .splice_read    = nfs_file_splice_read,
        .check_flags    = nfs_check_flags,
+       .setlease       = nfs_setlease,
 const struct inode_operations nfs_file_inode_operations = {
@@ -558,3 +560,13 @@ static int nfs_flock(struct file *filp, int cmd, struct 
file_lock *fl)
                return do_unlk(filp, cmd, fl);
        return do_setlk(filp, cmd, fl);
+static int nfs_setlease(struct file *file, long arg, struct file_lock **fl)
+       /*
+        * There is no protocol support for leases, so we have no way
+        * to implement them correctly in the face of opens by other
+        * clients.
+        */
+       return -EINVAL;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to