From 3934de7c697cf4d36a6e387d4a5e33933b508ee6 Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Thu, 1 Mar 2007 14:34:35 -0500 Subject: [PATCH] --- yaml --- r: 61445 b: refs/heads/master c: e32b8ee27b486f682a6d13533cfe6549c8abcdef h: refs/heads/master i: 61443: 2e9852a2cd3a6678782770b996fff9adba4559dd v: v3 --- [refs] | 2 +- trunk/fs/locks.c | 21 +++++++++------------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 0b4f65b7a7f8..e9a3b9bf6e1a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d2ab0b0c4c2570921a9ec1eff1e3a5143e05b231 +refs/heads/master: e32b8ee27b486f682a6d13533cfe6549c8abcdef diff --git a/trunk/fs/locks.c b/trunk/fs/locks.c index 3c23fd261022..838ca542c556 100644 --- a/trunk/fs/locks.c +++ b/trunk/fs/locks.c @@ -458,22 +458,20 @@ static int lease_init(struct file *filp, int type, struct file_lock *fl) } /* Allocate a file_lock initialised to this type of lease */ -static int lease_alloc(struct file *filp, int type, struct file_lock **flp) +static struct file_lock *lease_alloc(struct file *filp, int type) { struct file_lock *fl = locks_alloc_lock(); int error = -ENOMEM; if (fl == NULL) - goto out; + return ERR_PTR(error); error = lease_init(filp, type, fl); if (error) { locks_free_lock(fl); - fl = NULL; + return ERR_PTR(error); } -out: - *flp = fl; - return error; + return fl; } /* Check if two locks overlap each other. @@ -1179,12 +1177,10 @@ int __break_lease(struct inode *inode, unsigned int mode) int error = 0, future; struct file_lock *new_fl, *flock; struct file_lock *fl; - int alloc_err; unsigned long break_time; int i_have_this_lease = 0; - alloc_err = lease_alloc(NULL, mode & FMODE_WRITE ? F_WRLCK : F_RDLCK, - &new_fl); + new_fl = lease_alloc(NULL, mode & FMODE_WRITE ? F_WRLCK : F_RDLCK); lock_kernel(); @@ -1212,8 +1208,9 @@ int __break_lease(struct inode *inode, unsigned int mode) goto out; } - if (alloc_err && !i_have_this_lease && ((mode & O_NONBLOCK) == 0)) { - error = alloc_err; + if (IS_ERR(new_fl) && !i_have_this_lease + && ((mode & O_NONBLOCK) == 0)) { + error = PTR_ERR(new_fl); goto out; } @@ -1260,7 +1257,7 @@ int __break_lease(struct inode *inode, unsigned int mode) out: unlock_kernel(); - if (!alloc_err) + if (!IS_ERR(new_fl)) locks_free_lock(new_fl); return error; }