From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: linux-fsdevel@vger.kernel.org, nfs@lists.sourceforge.net,
"J. Bruce Fields" <bfields@citi.umich.edu>,
David Teigland <teigland@redhat.com>,
Marc Eshel <eshel@almaden.ibm.com>
Subject: Re: [PATCH] locks: share more common lease code
Date: Thu, 31 May 2007 17:51:37 -0400 [thread overview]
Message-ID: <1180648297.7084.7.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <11806476252240-git-send-email-bfields@fieldses.org>
On Thu, 2007-05-31 at 17:40 -0400, J. Bruce Fields wrote:
> From: J. Bruce Fields <bfields@citi.umich.edu>
>
> Share more code between setlease (used by nfsd) and fcntl.
>
> Also some minor cleanup.
>
> Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
> ---
> fs/locks.c | 14 +++-----------
> 1 files changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/fs/locks.c b/fs/locks.c
> index 431a8b8..3f366e1 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -1469,14 +1469,6 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
> struct inode *inode = dentry->d_inode;
> int error;
>
> - if ((current->fsuid != inode->i_uid) && !capable(CAP_LEASE))
> - return -EACCES;
> - if (!S_ISREG(inode->i_mode))
> - return -EINVAL;
> - error = security_file_lock(filp, arg);
> - if (error)
> - return error;
> -
> locks_init_lock(&fl);
> error = lease_init(filp, arg, &fl);
> if (error)
> @@ -1484,15 +1476,15 @@ int fcntl_setlease(unsigned int fd, struct file *filp, long arg)
>
> lock_kernel();
>
> - error = __setlease(filp, arg, &flp);
> + error = setlease(filp, arg, &flp);
> if (error || arg == F_UNLCK)
> goto out_unlock;
>
> error = fasync_helper(fd, filp, 1, &flp->fl_fasync);
> if (error < 0) {
> - /* remove lease just inserted by __setlease */
> + /* remove lease just inserted by setlease */
> flp->fl_type = F_UNLCK | F_INPROGRESS;
> - flp->fl_break_time = jiffies- 10;
> + flp->fl_break_time = jiffies - 10;
> time_out_leases(inode);
> goto out_unlock;
> }
Why not move the security checks from setlease() into __setlease()? That
way you can continue to avoid the calls to (re)take the BKL, which are
redundant as far as fcntl_setlease() is concerned.
Cheers
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
next prev parent reply other threads:[~2007-05-31 21:51 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-31 21:40 cluster-coherent leases J. Bruce Fields
2007-05-31 21:40 ` [PATCH] locks: share more common lease code J. Bruce Fields
2007-05-31 21:40 ` [PATCH] locks: provide a file lease method enabling cluster-coherent leases J. Bruce Fields
2007-05-31 21:40 ` [PATCH] gfs2: stop giving out non-cluster-coherent leases J. Bruce Fields
2007-05-31 22:34 ` [PATCH] locks: provide a file lease method enabling cluster-coherent leases Trond Myklebust
2007-06-01 16:53 ` [NFS] " J. Bruce Fields
2007-06-02 17:39 ` Trond Myklebust
2007-06-02 18:09 ` Marc Eshel
2007-06-02 18:21 ` Trond Myklebust
2007-06-04 13:59 ` J. Bruce Fields
2007-06-05 22:04 ` Robert Rappaport
2007-06-05 22:53 ` [NFS] " Trond Myklebust
2007-06-05 22:56 ` Marc Eshel
2007-06-05 23:40 ` Trond Myklebust
2007-06-06 18:43 ` Robert Rappaport
2007-06-07 14:43 ` [NFS] " Robert Rappaport
2007-06-07 17:05 ` J. Bruce Fields
2007-06-08 22:14 ` (no subject) J. Bruce Fields
2007-06-08 22:14 ` (unknown), J. Bruce Fields
[not found] ` <11813408953536-git-send-email->
2007-06-08 22:14 ` [PATCH 1/5] locks: share more common lease code J. Bruce Fields
2007-06-08 22:14 ` J. Bruce Fields
[not found] ` <11813408952518-git-send-email->
2007-06-08 22:14 ` [PATCH 2/5] locks: provide a file lease method enabling cluster-coherent leases J. Bruce Fields
2007-06-08 22:14 ` J. Bruce Fields
[not found] ` <11813408951909-git-send-email->
2007-06-08 22:14 ` [PATCH 3/5] locks: rename lease functions to reflect locks.c conventions J. Bruce Fields
2007-06-08 22:14 ` J. Bruce Fields
[not found] ` <11813408954053-git-send-email->
2007-06-08 22:14 ` [PATCH 4/5] gfs2: stop giving out non-cluster-coherent leases J. Bruce Fields
2007-06-08 22:14 ` J. Bruce Fields
[not found] ` <11813408951694-git-send-email->
2007-06-08 22:14 ` [PATCH 5/5] nfs: disable leases over NFS J. Bruce Fields
2007-06-08 22:14 ` J. Bruce Fields
2007-06-09 14:18 ` [PATCH 4/5] gfs2: stop giving out non-cluster-coherent leases Steven Whitehouse
2007-06-09 16:35 ` Marc Eshel
2007-06-11 9:38 ` Steven Whitehouse
2007-06-11 17:07 ` J. Bruce Fields
2007-06-09 16:56 ` [PATCH 3/5] locks: rename lease functions to reflect locks.c conventions Marc Eshel
2007-06-11 16:53 ` J. Bruce Fields
2007-06-02 18:23 ` [NFS] [PATCH] locks: provide a file lease method enabling cluster-coherent leases Trond Myklebust
2007-06-01 13:14 ` Peter Staubach
2007-06-01 16:44 ` [NFS] " J. Bruce Fields
2007-06-01 17:41 ` Matthew Wilcox
2007-06-01 18:08 ` J. Bruce Fields
2007-05-31 21:51 ` Trond Myklebust [this message]
2007-06-01 16:30 ` [NFS] [PATCH] locks: share more common lease code J. Bruce Fields
2007-06-01 16:36 ` Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1180648297.7084.7.camel@heimdal.trondhjem.org \
--to=trond.myklebust@fys.uio.no \
--cc=bfields@citi.umich.edu \
--cc=bfields@fieldses.org \
--cc=eshel@almaden.ibm.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=nfs@lists.sourceforge.net \
--cc=teigland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).