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 // (original code, adapted for DragonFly by swildner)
9 // URL: http://coccinelle.lip6.fr/
10 // URL: http://coccinellery.org/
12 // Applies to kernel code.
16 // * The results of running this patch have to be carefully reviewed.
17 // Some functions legally return with the lock held, even if the
18 // below pattern matches. Some other functions begin with the lock
19 // held, only to release and then reacquire it again.
21 // * Consider using -timeout because it might run a long time
22 // (indefinitely?) on some files.
25 // ACPI_SERIAL_BEGIN(...) / ACPI_SERIAL_END(...)
27 @rcu_ACPI_SERIAL_BEGIN exists@
32 ACPI_SERIAL_BEGIN@p1(E);
37 position rcu_ACPI_SERIAL_BEGIN.p1;
41 *ACPI_SERIAL_BEGIN@p1(E);
42 ... when != ACPI_SERIAL_END(E);
45 // crit_enter() / crit_exit()
47 @rcu_crit_enter exists@
56 position rcu_crit_enter.p1;
60 ... when != crit_exit();
63 // get_mplock() / rel_mplock()
65 @rcu_get_mplock exists@
74 position rcu_get_mplock.p1;
78 ... when != rel_mplock();
81 // lockmgr(..., {LK_EXCLUSIVE,LK_SHARED}) / lockmgr(..., LK_RELEASE)
88 lockmgr@p1(E,\(LK_SHARED\|LK_EXCLUSIVE\));
90 lockmgr(E,LK_RELEASE);
93 position rcu_lockmgr.p1;
97 *lockmgr@p1(E,\(LK_SHARED\|LK_EXCLUSIVE\));
98 ... when != lockmgr(E,LK_RELEASE);
101 // lwkt_gettoken(...) / lwkt_reltoken(...)
103 @rcu_lwkt_gettoken exists@
113 position rcu_lwkt_gettoken.p1;
117 *lwkt_gettoken@p1(E);
118 ... when != lwkt_reltoken(E);
121 // lwkt_serialize_enter(...) / lwkt_serialize_exit(...)
123 @rcu_lwkt_serialize_enter exists@
128 lwkt_serialize_enter@p1(E);
130 lwkt_serialize_exit(E);
133 position rcu_lwkt_serialize_enter.p1;
137 *lwkt_serialize_enter@p1(E);
138 ... when != lwkt_serialize_exit(E);
141 // nlookup_init(...) / nlookup_done(...)
143 @rcu_nlookup_init exists@
148 nlookup_init@p1(E,...);
153 position rcu_nlookup_init.p1;
157 *nlookup_init@p1(E,...);
158 ... when != nlookup_done(E);
161 // spin_lock(...) / spin_unlock(...)
163 @rcu_spin_lock exists@
173 position rcu_spin_lock.p1;
178 ... when != spin_unlock(E);
181 // vm_object_hold(...) / vm_object_drop(...)
183 @rcu_vm_object_hold exists@
188 vm_object_hold@p1(E);
193 position rcu_vm_object_hold.p1;
197 *vm_object_hold@p1(E);
198 ... when != vm_object_drop(E);
201 // vn_lock(...) / vn_unlock(...)
221 position rcu_vn_lock.p1;
230 ... when != \(vn_unlock\|vput\)(E);
233 // wlan_serialize_enter() / wlan_serialize_exit()
235 @rcu_wlan_serialize_enter exists@
239 wlan_serialize_enter@p1();
241 wlan_serialize_exit();
244 position rcu_wlan_serialize_enter.p1;
247 *wlan_serialize_enter@p1();
248 ... when != wlan_serialize_exit();