On Fri, Jun 29, 2007 at 11:30:27PM +0100, Steven Whitehouse wrote:
> EINVAL is fine by me, just so long as its not EAGAIN then it gets my
> blessing :-)

OK.  I've changed the error return, in both the NFS and GFS2 cases, did
some minor cleanup and commenting while I was at it, and pushed the
results out to "for-mm":

        git://linux-nfs.org/~bfields/linux.git for-mm

--b.

diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index e34d9bd..29a86fe 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -500,17 +500,15 @@ static int gfs2_fsync(struct file *file, struct dentry 
*dentry, int datasync)
 static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl)
 {
        struct gfs2_sbd *sdp = GFS2_SB(file->f_mapping->host);
-       int ret = -EOPNOTSUPP;
 
-       if (sdp->sd_args.ar_localflocks) {
+       /*
+        * We don't currently have a way to enforce a lease across the whole
+        * cluster; until we do, disable leases (by just returning -EINVAL),
+        * unless the administrator has requested purely local locking.
+        */
+       if (sdp->sd_args.ar_localflocks)
                return setlease(file, arg, fl);
-       }
-
-       /* For now fail the delegation request. Cluster file system can not
-          allow any node in the cluster to get a local lease until it can
-          be managed centrally by the cluster file system.
-       */
-       return ret;
+       return -EINVAL;
 }
 
 /**
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 97c1a3d..d92a383 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -560,5 +560,10 @@ 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)
 {
-       return -EOPNOTSUPP;
+       /*
+        * 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 linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to