2 // Look for missing lock releases before returning from a function.
4 // Applies to kernel code.
8 // * The results of running this patch have to be carefully reviewed.
9 // Some functions legally return with the lock held, even if the
10 // below pattern matches. Some other functions begin with the lock
11 // held, only to release and then reacquire it again.
13 // * Consider using -timeout because it might run a long time
14 // (indefinitely?) on some files.
17 // crit_enter() / crit_exit()
22 ... when != crit_exit()
26 if (...) { ... when != crit_exit()
34 // get_mplock() / rel_mplock()
39 ... when != rel_mplock()
43 if (...) { ... when != rel_mplock()
51 // lockmgr(..., {LK_EXCLUSIVE,LK_SHARED}) / lockmgr(..., LK_RELEASE)
56 lockmgr(l,\(LK_SHARED\|LK_EXCLUSIVE\));
57 ... when != lockmgr(l,LK_RELEASE)
61 if (...) { ... when != lockmgr(l,LK_RELEASE)
62 + lockmgr(l,LK_RELEASE);
66 lockmgr(l,LK_RELEASE);
69 // lwkt_gettoken(...) / lwkt_reltoken(...)
75 ... when != lwkt_reltoken(l)
79 if (...) { ... when != lwkt_reltoken(l)
87 // lwkt_serialize_enter(...) / lwkt_serialize_exit(...)
92 lwkt_serialize_enter(l);
93 ... when != lwkt_serialize_exit(l)
97 if (...) { ... when != lwkt_serialize_exit(l)
98 + lwkt_serialize_exit(l);
102 lwkt_serialize_exit(l);
105 // spin_lock(...) / spin_unlock(...)
111 ... when != spin_unlock(l)
115 if (...) { ... when != spin_unlock(l)