diff options
Diffstat (limited to 'fs/locks.c')
| -rw-r--r-- | fs/locks.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/fs/locks.c b/fs/locks.c index 5b526a977882..65765cb6afed 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
| @@ -235,11 +235,8 @@ static void locks_copy_private(struct file_lock *new, struct file_lock *fl) | |||
| 235 | fl->fl_ops->fl_copy_lock(new, fl); | 235 | fl->fl_ops->fl_copy_lock(new, fl); |
| 236 | new->fl_ops = fl->fl_ops; | 236 | new->fl_ops = fl->fl_ops; |
| 237 | } | 237 | } |
| 238 | if (fl->fl_lmops) { | 238 | if (fl->fl_lmops) |
| 239 | if (fl->fl_lmops->fl_copy_lock) | ||
| 240 | fl->fl_lmops->fl_copy_lock(new, fl); | ||
| 241 | new->fl_lmops = fl->fl_lmops; | 239 | new->fl_lmops = fl->fl_lmops; |
| 242 | } | ||
| 243 | } | 240 | } |
| 244 | 241 | ||
| 245 | /* | 242 | /* |
| @@ -1428,8 +1425,9 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp) | |||
| 1428 | goto out; | 1425 | goto out; |
| 1429 | 1426 | ||
| 1430 | if (my_before != NULL) { | 1427 | if (my_before != NULL) { |
| 1431 | *flp = *my_before; | ||
| 1432 | error = lease->fl_lmops->fl_change(my_before, arg); | 1428 | error = lease->fl_lmops->fl_change(my_before, arg); |
| 1429 | if (!error) | ||
| 1430 | *flp = *my_before; | ||
| 1433 | goto out; | 1431 | goto out; |
| 1434 | } | 1432 | } |
| 1435 | 1433 | ||
| @@ -1444,8 +1442,6 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp) | |||
| 1444 | return 0; | 1442 | return 0; |
| 1445 | 1443 | ||
| 1446 | out: | 1444 | out: |
| 1447 | if (arg != F_UNLCK) | ||
| 1448 | locks_free_lock(lease); | ||
| 1449 | return error; | 1445 | return error; |
| 1450 | } | 1446 | } |
| 1451 | EXPORT_SYMBOL(generic_setlease); | 1447 | EXPORT_SYMBOL(generic_setlease); |
| @@ -1524,8 +1520,11 @@ static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) | |||
| 1524 | } | 1520 | } |
| 1525 | lock_flocks(); | 1521 | lock_flocks(); |
| 1526 | error = __vfs_setlease(filp, arg, &fl); | 1522 | error = __vfs_setlease(filp, arg, &fl); |
| 1527 | if (error) | 1523 | if (error) { |
| 1528 | goto out_unlock; | 1524 | unlock_flocks(); |
| 1525 | locks_free_lock(fl); | ||
| 1526 | goto out_free_fasync; | ||
| 1527 | } | ||
| 1529 | 1528 | ||
| 1530 | /* | 1529 | /* |
| 1531 | * fasync_insert_entry() returns the old entry if any. | 1530 | * fasync_insert_entry() returns the old entry if any. |
| @@ -1541,12 +1540,12 @@ static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) | |||
| 1541 | fl->fl_type = F_UNLCK | F_INPROGRESS; | 1540 | fl->fl_type = F_UNLCK | F_INPROGRESS; |
| 1542 | fl->fl_break_time = jiffies - 10; | 1541 | fl->fl_break_time = jiffies - 10; |
| 1543 | time_out_leases(inode); | 1542 | time_out_leases(inode); |
| 1544 | goto out_unlock; | 1543 | } else { |
| 1544 | error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); | ||
| 1545 | } | 1545 | } |
| 1546 | |||
| 1547 | error = __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); | ||
| 1548 | out_unlock: | ||
| 1549 | unlock_flocks(); | 1546 | unlock_flocks(); |
| 1547 | |||
| 1548 | out_free_fasync: | ||
| 1550 | if (new) | 1549 | if (new) |
| 1551 | fasync_free(new); | 1550 | fasync_free(new); |
| 1552 | return error; | 1551 | return error; |
