@@ -681,21 +681,18 @@ static void locks_wake_up_blocks(struct file_lock *blocker)
681681}
682682
683683static void
684- locks_insert_lock_ctx (struct file_lock * fl , int * counter ,
685- struct list_head * before )
684+ locks_insert_lock_ctx (struct file_lock * fl , struct list_head * before )
686685{
687686 fl -> fl_nspid = get_pid (task_tgid (current ));
688687 list_add_tail (& fl -> fl_list , before );
689- ++ * counter ;
690688 locks_insert_global_locks (fl );
691689}
692690
693691static void
694- locks_unlink_lock_ctx (struct file_lock * fl , int * counter )
692+ locks_unlink_lock_ctx (struct file_lock * fl )
695693{
696694 locks_delete_global_locks (fl );
697695 list_del_init (& fl -> fl_list );
698- -- * counter ;
699696 if (fl -> fl_nspid ) {
700697 put_pid (fl -> fl_nspid );
701698 fl -> fl_nspid = NULL ;
@@ -704,10 +701,9 @@ locks_unlink_lock_ctx(struct file_lock *fl, int *counter)
704701}
705702
706703static void
707- locks_delete_lock_ctx (struct file_lock * fl , int * counter ,
708- struct list_head * dispose )
704+ locks_delete_lock_ctx (struct file_lock * fl , struct list_head * dispose )
709705{
710- locks_unlink_lock_ctx (fl , counter );
706+ locks_unlink_lock_ctx (fl );
711707 if (dispose )
712708 list_add (& fl -> fl_list , dispose );
713709 else
@@ -895,7 +891,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
895891 if (request -> fl_type == fl -> fl_type )
896892 goto out ;
897893 found = true;
898- locks_delete_lock_ctx (fl , & ctx -> flc_flock_cnt , & dispose );
894+ locks_delete_lock_ctx (fl , & dispose );
899895 break ;
900896 }
901897
@@ -929,7 +925,7 @@ static int flock_lock_file(struct file *filp, struct file_lock *request)
929925 if (request -> fl_flags & FL_ACCESS )
930926 goto out ;
931927 locks_copy_lock (new_fl , request );
932- locks_insert_lock_ctx (new_fl , & ctx -> flc_flock_cnt , & ctx -> flc_flock );
928+ locks_insert_lock_ctx (new_fl , & ctx -> flc_flock );
933929 new_fl = NULL ;
934930 error = 0 ;
935931
@@ -1046,8 +1042,7 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
10461042 else
10471043 request -> fl_end = fl -> fl_end ;
10481044 if (added ) {
1049- locks_delete_lock_ctx (fl , & ctx -> flc_posix_cnt ,
1050- & dispose );
1045+ locks_delete_lock_ctx (fl , & dispose );
10511046 continue ;
10521047 }
10531048 request = fl ;
@@ -1076,8 +1071,7 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
10761071 * one (This may happen several times).
10771072 */
10781073 if (added ) {
1079- locks_delete_lock_ctx (fl ,
1080- & ctx -> flc_posix_cnt , & dispose );
1074+ locks_delete_lock_ctx (fl , & dispose );
10811075 continue ;
10821076 }
10831077 /*
@@ -1093,10 +1087,8 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
10931087 locks_copy_lock (new_fl , request );
10941088 request = new_fl ;
10951089 new_fl = NULL ;
1096- locks_insert_lock_ctx (request ,
1097- & ctx -> flc_posix_cnt , & fl -> fl_list );
1098- locks_delete_lock_ctx (fl ,
1099- & ctx -> flc_posix_cnt , & dispose );
1090+ locks_insert_lock_ctx (request , & fl -> fl_list );
1091+ locks_delete_lock_ctx (fl , & dispose );
11001092 added = true;
11011093 }
11021094 }
@@ -1124,8 +1116,7 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
11241116 goto out ;
11251117 }
11261118 locks_copy_lock (new_fl , request );
1127- locks_insert_lock_ctx (new_fl , & ctx -> flc_posix_cnt ,
1128- & fl -> fl_list );
1119+ locks_insert_lock_ctx (new_fl , & fl -> fl_list );
11291120 new_fl = NULL ;
11301121 }
11311122 if (right ) {
@@ -1136,8 +1127,7 @@ static int __posix_lock_file(struct inode *inode, struct file_lock *request, str
11361127 left = new_fl2 ;
11371128 new_fl2 = NULL ;
11381129 locks_copy_lock (left , right );
1139- locks_insert_lock_ctx (left , & ctx -> flc_posix_cnt ,
1140- & fl -> fl_list );
1130+ locks_insert_lock_ctx (left , & fl -> fl_list );
11411131 }
11421132 right -> fl_start = request -> fl_end + 1 ;
11431133 locks_wake_up_blocks (right );
@@ -1321,7 +1311,6 @@ static void lease_clear_pending(struct file_lock *fl, int arg)
13211311/* We already had a lease on this file; just change its type */
13221312int lease_modify (struct file_lock * fl , int arg , struct list_head * dispose )
13231313{
1324- struct file_lock_context * flctx ;
13251314 int error = assign_type (fl , arg );
13261315
13271316 if (error )
@@ -1331,15 +1320,14 @@ int lease_modify(struct file_lock *fl, int arg, struct list_head *dispose)
13311320 if (arg == F_UNLCK ) {
13321321 struct file * filp = fl -> fl_file ;
13331322
1334- flctx = file_inode (filp )-> i_flctx ;
13351323 f_delown (filp );
13361324 filp -> f_owner .signum = 0 ;
13371325 fasync_helper (0 , fl -> fl_file , 0 , & fl -> fl_fasync );
13381326 if (fl -> fl_fasync != NULL ) {
13391327 printk (KERN_ERR "locks_delete_lock: fasync == %p\n" , fl -> fl_fasync );
13401328 fl -> fl_fasync = NULL ;
13411329 }
1342- locks_delete_lock_ctx (fl , & flctx -> flc_lease_cnt , dispose );
1330+ locks_delete_lock_ctx (fl , dispose );
13431331 }
13441332 return 0 ;
13451333}
@@ -1456,8 +1444,7 @@ int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
14561444 fl -> fl_downgrade_time = break_time ;
14571445 }
14581446 if (fl -> fl_lmops -> lm_break (fl ))
1459- locks_delete_lock_ctx (fl , & ctx -> flc_lease_cnt ,
1460- & dispose );
1447+ locks_delete_lock_ctx (fl , & dispose );
14611448 }
14621449
14631450 if (list_empty (& ctx -> flc_lease ))
@@ -1697,7 +1684,7 @@ generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **pr
16971684 if (!leases_enable )
16981685 goto out ;
16991686
1700- locks_insert_lock_ctx (lease , & ctx -> flc_lease_cnt , & ctx -> flc_lease );
1687+ locks_insert_lock_ctx (lease , & ctx -> flc_lease );
17011688 /*
17021689 * The check in break_lease() is lockless. It's possible for another
17031690 * open to race in after we did the earlier check for a conflicting
@@ -1710,7 +1697,7 @@ generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **pr
17101697 smp_mb ();
17111698 error = check_conflicting_open (dentry , arg , lease -> fl_flags );
17121699 if (error ) {
1713- locks_unlink_lock_ctx (lease , & ctx -> flc_lease_cnt );
1700+ locks_unlink_lock_ctx (lease );
17141701 goto out ;
17151702 }
17161703
0 commit comments