Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Sep 2022 01:29:22 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 31930b3a0dea - stable/13 - fork_norfproc(): unlock p1 before retrying
Message-ID:  <202209030129.2831TM32002618@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=31930b3a0dead191adb008be6b2bce66804c91d8

commit 31930b3a0dead191adb008be6b2bce66804c91d8
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-08-10 17:03:31 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-09-03 01:17:36 +0000

    fork_norfproc(): unlock p1 before retrying
    
    (cherry picked from commit 5e9bba94bd7f6b61d6c9fcef239e963e55c1a87a)
---
 sys/kern/kern_fork.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 7cca7050c0ff..862e61bad207 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -322,13 +322,11 @@ again:
 	if ((p1->p_flag & (P_HADTHREADS | P_SYSTEM)) == P_HADTHREADS &&
 	    ((flags & (RFCFDG | RFFDG)) != 0 || (flags & RFMEM) == 0)) {
 		PROC_LOCK(p1);
-		while (p1->p_singlethr > 0) {
+		if (p1->p_singlethr > 0) {
 			error = msleep(&p1->p_singlethr, &p1->p_mtx,
-			    PWAIT | PCATCH, "rfork1t", 0);
-			if (error != 0) {
-				PROC_UNLOCK(p1);
+			    PWAIT | PCATCH | PDROP, "rfork1t", 0);
+			if (error != 0)
 				return (ERESTART);
-			}
 			goto again;
 		}
 		if (thread_single(p1, SINGLE_BOUNDARY)) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202209030129.2831TM32002618>