Module Name:    src
Committed By:   ad
Date:           Wed Oct  4 20:45:14 UTC 2023

Modified Files:
        src/sys/kern: kern_lwp.c

Log Message:
lwp_wait(): restart the loop if p->p_lock dropped to reap zombie (paranoid).


To generate a diff of this commit:
cvs rdiff -u -r1.260 -r1.261 src/sys/kern/kern_lwp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.260 src/sys/kern/kern_lwp.c:1.261
--- src/sys/kern/kern_lwp.c:1.260	Wed Oct  4 20:44:15 2023
+++ src/sys/kern/kern_lwp.c	Wed Oct  4 20:45:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.260 2023/10/04 20:44:15 ad Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.261 2023/10/04 20:45:13 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019, 2020, 2023
@@ -217,7 +217,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.260 2023/10/04 20:44:15 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.261 2023/10/04 20:45:13 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -612,10 +612,11 @@ lwp_wait(struct lwp *l, lwpid_t lid, lwp
 		 * First off, drain any detached LWP that is waiting to be
 		 * reaped.
 		 */
-		while ((l2 = p->p_zomblwp) != NULL) {
+		if ((l2 = p->p_zomblwp) != NULL) {
 			p->p_zomblwp = NULL;
 			lwp_free(l2, false, false);/* releases proc mutex */
 			mutex_enter(p->p_lock);
+			continue;
 		}
 
 		/*

Reply via email to