aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2018-04-24 18:41:14 +0000
committerConrad Meyer <cem@FreeBSD.org>2018-04-24 18:41:14 +0000
commitb543c98cabf5c9a0afc48e5761b20f900da9998a (patch)
tree26d17f487952eb459ca024d7944a4eecb3f2dee8 /sys/kern/kern_lock.c
parentf07562ebb46312ff8894dced6e7ef5ff53f955e5 (diff)
downloadsrc-b543c98cabf5c9a0afc48e5761b20f900da9998a.tar.gz
src-b543c98cabf5c9a0afc48e5761b20f900da9998a.zip
lockmgr: Add missed neutering during panic
r313683 introduced new lockmgr APIs that missed the panic-time neutering present in the rest of our locks. Correct that by adding the usual check. Additionally, move the __lockmgr_args neutering above the assertions at the top of the function. Drop the interlock unlock because we shouldn't have an unneutered interlock either. No point trying to unlock it. PR: 227749 Reported by: jtl Sponsored by: Dell EMC Isilon
Notes
Notes: svn path=/head/; revision=332957
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index cc59fbacf63a..9fbee4dcdc30 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -918,6 +918,9 @@ lockmgr_lock_fast_path(struct lock *lk, u_int flags, struct lock_object *ilk,
u_int op;
bool locked;
+ if (__predict_false(panicstr != NULL))
+ return (0);
+
op = flags & LK_TYPE_MASK;
locked = false;
switch (op) {
@@ -1100,6 +1103,9 @@ lockmgr_unlock_fast_path(struct lock *lk, u_int flags, struct lock_object *ilk)
const char *file;
int line;
+ if (__predict_false(panicstr != NULL))
+ return (0);
+
file = __FILE__;
line = __LINE__;
@@ -1146,6 +1152,9 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
int contested = 0;
#endif
+ if (panicstr != NULL)
+ return (0);
+
error = 0;
tid = (uintptr_t)curthread;
op = (flags & LK_TYPE_MASK);
@@ -1172,11 +1181,6 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
lk->lock_object.lo_name, file, line));
class = (flags & LK_INTERLOCK) ? LOCK_CLASS(ilk) : NULL;
- if (panicstr != NULL) {
- if (flags & LK_INTERLOCK)
- class->lc_unlock(ilk);
- return (0);
- }
if (lk->lock_object.lo_flags & LK_NOSHARE) {
switch (op) {