[PATCH] locks: share more common lease code

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: J. Bruce Fields
Date: Thursday, May 31, 2007 - 2:40 pm

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;
 	}
-- 
1.5.2.rc3


-------------------------------------------------------------------------
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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
cluster-coherent leases, J. Bruce Fields, (Thu May 31, 2:40 pm)
[PATCH] locks: share more common lease code, J. Bruce Fields, (Thu May 31, 2:40 pm)
[PATCH] gfs2: stop giving out non-cluster-coherent leases, J. Bruce Fields, (Thu May 31, 2:40 pm)
Re: [PATCH] locks: share more common lease code, Trond Myklebust, (Thu May 31, 2:51 pm)
Re: [NFS] [PATCH] locks: share more common lease code, J. Bruce Fields, (Fri Jun 1, 9:30 am)
Re: [NFS] [PATCH] locks: share more common lease code, Trond Myklebust, (Fri Jun 1, 9:36 am)
(no subject), J. Bruce Fields, (Fri Jun 8, 3:14 pm)
(unknown), J. Bruce Fields, (Fri Jun 8, 3:14 pm)