aboutsummaryrefslogtreecommitdiffstats
path: root/fs/locks.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-10-09 15:20:05 -0400
committerThomas Gleixner <tglx@linutronix.de>2012-10-09 15:20:05 -0400
commitdb8c246937713e60b7628661ccc187eeb81f2bae (patch)
tree6351e8bca23eef40fce85396d1c6f6cfffbd4b66 /fs/locks.c
parentc5f66e99b7cb091e3d51ae8e8156892e8feb7fa3 (diff)
parent28f2b02bc581ffc835bc1691b18d03f62fcf0395 (diff)
Merge branch 'fortglx/3.7/time' of git://git.linaro.org/people/jstultz/linux into timers/core
Diffstat (limited to 'fs/locks.c')
-rw-r--r--fs/locks.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/fs/locks.c b/fs/locks.c
index fce6238d52c..7e81bfc7516 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -200,11 +200,7 @@ void locks_release_private(struct file_lock *fl)
200 fl->fl_ops->fl_release_private(fl); 200 fl->fl_ops->fl_release_private(fl);
201 fl->fl_ops = NULL; 201 fl->fl_ops = NULL;
202 } 202 }
203 if (fl->fl_lmops) { 203 fl->fl_lmops = NULL;
204 if (fl->fl_lmops->lm_release_private)
205 fl->fl_lmops->lm_release_private(fl);
206 fl->fl_lmops = NULL;
207 }
208 204
209} 205}
210EXPORT_SYMBOL_GPL(locks_release_private); 206EXPORT_SYMBOL_GPL(locks_release_private);
@@ -308,7 +304,7 @@ static int flock_make_lock(struct file *filp, struct file_lock **lock,
308 return 0; 304 return 0;
309} 305}
310 306
311static int assign_type(struct file_lock *fl, int type) 307static int assign_type(struct file_lock *fl, long type)
312{ 308{
313 switch (type) { 309 switch (type) {
314 case F_RDLCK: 310 case F_RDLCK:
@@ -427,25 +423,15 @@ static void lease_break_callback(struct file_lock *fl)
427 kill_fasync(&fl->fl_fasync, SIGIO, POLL_MSG); 423 kill_fasync(&fl->fl_fasync, SIGIO, POLL_MSG);
428} 424}
429 425
430static void lease_release_private_callback(struct file_lock *fl)
431{
432 if (!fl->fl_file)
433 return;
434
435 f_delown(fl->fl_file);
436 fl->fl_file->f_owner.signum = 0;
437}
438
439static const struct lock_manager_operations lease_manager_ops = { 426static const struct lock_manager_operations lease_manager_ops = {
440 .lm_break = lease_break_callback, 427 .lm_break = lease_break_callback,
441 .lm_release_private = lease_release_private_callback,
442 .lm_change = lease_modify, 428 .lm_change = lease_modify,
443}; 429};
444 430
445/* 431/*
446 * Initialize a lease, use the default lock manager operations 432 * Initialize a lease, use the default lock manager operations
447 */ 433 */
448static int lease_init(struct file *filp, int type, struct file_lock *fl) 434static int lease_init(struct file *filp, long type, struct file_lock *fl)
449 { 435 {
450 if (assign_type(fl, type) != 0) 436 if (assign_type(fl, type) != 0)
451 return -EINVAL; 437 return -EINVAL;
@@ -463,7 +449,7 @@ static int lease_init(struct file *filp, int type, struct file_lock *fl)
463} 449}
464 450
465/* Allocate a file_lock initialised to this type of lease */ 451/* Allocate a file_lock initialised to this type of lease */
466static struct file_lock *lease_alloc(struct file *filp, int type) 452static struct file_lock *lease_alloc(struct file *filp, long type)
467{ 453{
468 struct file_lock *fl = locks_alloc_lock(); 454 struct file_lock *fl = locks_alloc_lock();
469 int error = -ENOMEM; 455 int error = -ENOMEM;
@@ -580,12 +566,6 @@ static void locks_delete_lock(struct file_lock **thisfl_p)
580 fl->fl_next = NULL; 566 fl->fl_next = NULL;
581 list_del_init(&fl->fl_link); 567 list_del_init(&fl->fl_link);
582 568
583 fasync_helper(0, fl->fl_file, 0, &fl->fl_fasync);
584 if (fl->fl_fasync != NULL) {
585 printk(KERN_ERR "locks_delete_lock: fasync == %p\n", fl->fl_fasync);
586 fl->fl_fasync = NULL;
587 }
588
589 if (fl->fl_nspid) { 569 if (fl->fl_nspid) {
590 put_pid(fl->fl_nspid); 570 put_pid(fl->fl_nspid);
591 fl->fl_nspid = NULL; 571 fl->fl_nspid = NULL;
@@ -1155,8 +1135,18 @@ int lease_modify(struct file_lock **before, int arg)
1155 return error; 1135 return error;
1156 lease_clear_pending(fl, arg); 1136 lease_clear_pending(fl, arg);
1157 locks_wake_up_blocks(fl); 1137 locks_wake_up_blocks(fl);
1158 if (arg == F_UNLCK) 1138 if (arg == F_UNLCK) {
1139 struct file *filp = fl->fl_file;
1140
1141 f_delown(filp);
1142 filp->f_owner.signum = 0;
1143 fasync_helper(0, fl->fl_file, 0, &fl->fl_fasync);
1144 if (fl->fl_fasync != NULL) {
1145 printk(KERN_ERR "locks_delete_lock: fasync == %p\n", fl->fl_fasync);
1146 fl->fl_fasync = NULL;
1147 }
1159 locks_delete_lock(before); 1148 locks_delete_lock(before);
1149 }
1160 return 0; 1150 return 0;
1161} 1151}
1162 1152