aboutsummaryrefslogtreecommitdiffstats
path: root/fs/locks.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/locks.c')
-rw-r--r--fs/locks.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 5b526a977882..a2ab790471b5 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1428,8 +1428,9 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp)
1428 goto out; 1428 goto out;
1429 1429
1430 if (my_before != NULL) { 1430 if (my_before != NULL) {
1431 *flp = *my_before;
1432 error = lease->fl_lmops->fl_change(my_before, arg); 1431 error = lease->fl_lmops->fl_change(my_before, arg);
1432 if (!error)
1433 *flp = *my_before;
1433 goto out; 1434 goto out;
1434 } 1435 }
1435 1436
@@ -1444,8 +1445,6 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp)
1444 return 0; 1445 return 0;
1445 1446
1446out: 1447out:
1447 if (arg != F_UNLCK)
1448 locks_free_lock(lease);
1449 return error; 1448 return error;
1450} 1449}
1451EXPORT_SYMBOL(generic_setlease); 1450EXPORT_SYMBOL(generic_setlease);
@@ -1524,8 +1523,11 @@ static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg)
1524 } 1523 }
1525 lock_flocks(); 1524 lock_flocks();
1526 error = __vfs_setlease(filp, arg, &fl); 1525 error = __vfs_setlease(filp, arg, &fl);
1527 if (error) 1526 if (error) {
1528 goto out_unlock; 1527 unlock_flocks();
1528 locks_free_lock(fl);
1529 goto out_free_fasync;
1530 }
1529 1531
1530 /* 1532 /*
1531 * fasync_insert_entry() returns the old entry if any. 1533 * fasync_insert_entry() returns the old entry if any.
@@ -1541,12 +1543,12 @@ static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg)
1541 fl->fl_type = F_UNLCK | F_INPROGRESS; 1543 fl->fl_type = F_UNLCK | F_INPROGRESS;
1542 fl->fl_break_time = jiffies - 10; 1544 fl->fl_break_time = jiffies - 10;
1543 time_out_leases(inode); 1545 time_out_leases(inode);
1544 goto out_unlock; 1546 } else {
1547 error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0);
1545 } 1548 }
1546
1547 error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0);
1548out_unlock:
1549 unlock_flocks(); 1549 unlock_flocks();
1550
1551out_free_fasync:
1550 if (new) 1552 if (new)
1551 fasync_free(new); 1553 fasync_free(new);
1552 return error; 1554 return error;