2 // Look for missing lock releases before returning from an error path.
5 // Copyright: 2012 - LIP6/INRIA
6 // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license
7 // Author: Julia Lawall <Julia.Lawall@lip6.fr>
8 // URL: http://coccinelle.lip6.fr/
9 // URL: http://coccinellery.org/
11 // Applies to kernel code.
15 // * The results of running this patch have to be carefully reviewed.
16 // Some functions legally return with the lock held, even if the
17 // below pattern matches. Some other functions begin with the lock
18 // held, only to release and then reacquire it again.
20 // * Consider using -timeout because it might run a long time
21 // (indefinitely?) on some files.
24 // crit_enter() / crit_exit()
26 @rcu_crit_enter exists@
35 position rcu_crit_enter.p1;
39 ... when != crit_exit();
42 // get_mplock() / rel_mplock()
44 @rcu_get_mplock exists@
53 position rcu_get_mplock.p1;
57 ... when != rel_mplock();
60 // lockmgr(..., {LK_EXCLUSIVE,LK_SHARED}) / lockmgr(..., LK_RELEASE)
67 lockmgr@p1(E,\(LK_SHARED\|LK_EXCLUSIVE\));
69 lockmgr(E,LK_RELEASE);
72 position rcu_lockmgr.p1;
76 *lockmgr@p1(E,\(LK_SHARED\|LK_EXCLUSIVE\));
77 ... when != lockmgr(E,LK_RELEASE);
80 // lwkt_gettoken(...) / lwkt_reltoken(...)
82 @rcu_lwkt_gettoken exists@
92 position rcu_lwkt_gettoken.p1;
97 ... when != lwkt_reltoken(E);
100 // lwkt_serialize_enter(...) / lwkt_serialize_exit(...)
102 @rcu_lwkt_serialize_enter exists@
107 lwkt_serialize_enter@p1(E);
109 lwkt_serialize_exit(E);
112 position rcu_lwkt_serialize_enter.p1;
116 *lwkt_serialize_enter@p1(E);
117 ... when != lwkt_serialize_exit(E);
120 // spin_lock(...) / spin_unlock(...)
122 @rcu_spin_lock exists@
132 position rcu_spin_lock.p1;
137 ... when != spin_unlock(E);
140 // vm_object_hold(...) / vm_object_drop(...)
142 @rcu_vm_object_hold exists@
147 vm_object_hold@p1(E);
152 position rcu_vm_object_hold.p1;
156 *vm_object_hold@p1(E);
157 ... when != vm_object_drop(E);