From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Staubach Subject: Re: [PATCH 6/6] nfs: disable leases over NFS Date: Fri, 29 Jun 2007 17:16:19 -0400 Message-ID: <468576A3.3000809@redhat.com> References: <1183144890244-git-send-email-bfields@fieldses.org> <11831448902131-git-send-email-bfields@fieldses.org> <1183144890833-git-send-email-bfields@fieldses.org> <11831448901518-git-send-email-bfields@fieldses.org> <1183144890363-git-send-email-bfields@fieldses.org> <11831448903796-git-send-email-bfields@fieldses.org> <11831448913779-git-send-email-bfields@fieldses.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Andrew Morton , linux-fsdevel@vger.kernel.org, "J. Bruce Fields" , Trond Myklebust To: "J. Bruce Fields" Return-path: Received: from mx1.redhat.com ([66.187.233.31]:43756 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755366AbXF2VQ0 (ORCPT ); Fri, 29 Jun 2007 17:16:26 -0400 In-Reply-To: <11831448913779-git-send-email-bfields@fieldses.org> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org J. Bruce Fields wrote: > From: J. Bruce Fields > > As Peter Staubach says elsewhere > (http://marc.info/?l=linux-kernel&m=118113649526444&w=2): > > >> 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 -EOPNOTSUPP. > > 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" > Cc: Peter Staubach > Cc: Trond Myklebust > --- > fs/nfs/file.c | 7 +++++++ > 1 files changed, 7 insertions(+), 0 deletions(-) > > diff --git a/fs/nfs/file.c b/fs/nfs/file.c > index 9eb8eb4..97c1a3d 100644 > --- a/fs/nfs/file.c > +++ b/fs/nfs/file.c > @@ -51,6 +51,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, > @@ -67,6 +68,7 @@ const struct file_operations nfs_file_operations = { > .flock = nfs_flock, > .sendfile = nfs_file_sendfile, > .check_flags = nfs_check_flags, > + .setlease = nfs_setlease, > }; > > const struct inode_operations nfs_file_inode_operations = { > @@ -555,3 +557,8 @@ 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) > +{ > + return -EOPNOTSUPP; > +} > A couple of things -- First, there is already some support to disable leases for NFS mounted file systems in -mm, I think. Are you planning on removing it? Second, it seems to me that EINVAL would be a better error to return than EOPNOTSUPP. This is an invalid operation to apply to this file and might match POSIX style specs better. Thanx... ps