git: 209131e656bc - stable/13 - weed_inhib(): do not double-suspend already suspended thread if the loop reiterates

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Fri, 24 Jun 2022 19:36:58 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=209131e656bc2b0f22f309a73b168ff5d7c52ec9

commit 209131e656bc2b0f22f309a73b168ff5d7c52ec9
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-04-30 23:30:13 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-06-24 14:45:45 +0000

    weed_inhib(): do not double-suspend already suspended thread if the loop reiterates
    
    (cherry picked from commit b9893b353312cc3c75a0ab2ff7ca69dc55864bea)
---
 sys/kern/kern_thread.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 5e32a8be8f4e..10b3f1a27876 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -1144,7 +1144,8 @@ restart:
 		}
 		if (TD_CAN_ABORT(td2)) {
 			if ((td2->td_flags & TDF_SBDRY) == 0) {
-				thread_suspend_one(td2);
+				if (!TD_IS_SUSPENDED(td2))
+					thread_suspend_one(td2);
 				td2->td_flags |= TDF_ALLPROCSUSP;
 			} else {
 				wakeup_swapper |= sleepq_abort(td2, ERESTART);