Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 61445
b: refs/heads/master
c: e32b8ee
h: refs/heads/master
i:
  61443: 2e9852a
v: v3
  • Loading branch information
J. Bruce Fields committed Jul 18, 2007
1 parent 6416ada commit 3934de7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d2ab0b0c4c2570921a9ec1eff1e3a5143e05b231
refs/heads/master: e32b8ee27b486f682a6d13533cfe6549c8abcdef
21 changes: 9 additions & 12 deletions trunk/fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 3934de7

Please sign in to comment.