aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Horne <mhorne@FreeBSD.org>2023-02-22 15:11:15 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2023-02-22 15:12:22 +0000
commit9a7f7c26c5b280924072e2d9947ad39ef4cc022c (patch)
treec2dee1497db0352207d25907a250cc43dd8e16f3
parent624de4eca5458655cb78a0397c17306880a99f7a (diff)
downloadsrc-9a7f7c26c5b280924072e2d9947ad39ef4cc022c.tar.gz
src-9a7f7c26c5b280924072e2d9947ad39ef4cc022c.zip
lockmgr: upgrade panic return checks
We short-circuit lockmgr functions in the face of a kernel panic. Other lock implementations do this with a SCHEDULER_STOPPED() check, which covers the additional case where the debugger is active but the system has not panicked. Update this code to match that behaviour. Reviewed by: mjg, kib, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38655
-rw-r--r--sys/kern/kern_lock.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 2eb4feb7c4b5..ee34e03188a5 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -603,7 +603,7 @@ lockmgr_slock_hard(struct lock *lk, u_int flags, struct lock_object *ilk,
#endif
struct lock_delay_arg lda;
- if (KERNEL_PANICKED())
+ if (SCHEDULER_STOPPED())
goto out;
tid = (uintptr_t)curthread;
@@ -789,7 +789,7 @@ lockmgr_xlock_hard(struct lock *lk, u_int flags, struct lock_object *ilk,
#endif
struct lock_delay_arg lda;
- if (KERNEL_PANICKED())
+ if (SCHEDULER_STOPPED())
goto out;
tid = (uintptr_t)curthread;
@@ -985,7 +985,7 @@ lockmgr_upgrade(struct lock *lk, u_int flags, struct lock_object *ilk,
int error = 0;
int op;
- if (KERNEL_PANICKED())
+ if (SCHEDULER_STOPPED())
goto out;
tid = (uintptr_t)curthread;
@@ -1046,7 +1046,7 @@ lockmgr_lock_flags(struct lock *lk, u_int flags, struct lock_object *ilk,
u_int op;
bool locked;
- if (KERNEL_PANICKED())
+ if (SCHEDULER_STOPPED())
return (0);
op = flags & LK_TYPE_MASK;
@@ -1109,7 +1109,7 @@ lockmgr_sunlock_hard(struct lock *lk, uintptr_t x, u_int flags, struct lock_obje
{
int wakeup_swapper = 0;
- if (KERNEL_PANICKED())
+ if (SCHEDULER_STOPPED())
goto out;
wakeup_swapper = wakeupshlk(lk, file, line);
@@ -1128,7 +1128,7 @@ lockmgr_xunlock_hard(struct lock *lk, uintptr_t x, u_int flags, struct lock_obje
u_int realexslp;
int queue;
- if (KERNEL_PANICKED())
+ if (SCHEDULER_STOPPED())
goto out;
tid = (uintptr_t)curthread;
@@ -1320,7 +1320,7 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,
int contested = 0;
#endif
- if (KERNEL_PANICKED())
+ if (SCHEDULER_STOPPED())
return (0);
error = 0;
@@ -1729,7 +1729,7 @@ _lockmgr_assert(const struct lock *lk, int what, const char *file, int line)
{
int slocked = 0;
- if (KERNEL_PANICKED())
+ if (SCHEDULER_STOPPED())
return;
switch (what) {
case KA_SLOCKED: