git: 331613ddd8a5 - main - Pause failpoint: replace mtx_sleep with tsleep

From: Ryan Libby <rlibby_at_FreeBSD.org>
Date: Wed, 10 Jun 2026 21:19:46 UTC
The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=331613ddd8a516e8eaf841f293754fa47cb339aa

commit 331613ddd8a516e8eaf841f293754fa47cb339aa
Author:     Mark Ranger <markovic@internode.on.net>
AuthorDate: 2026-05-25 22:32:50 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2026-06-10 21:13:05 +0000

    Pause failpoint: replace mtx_sleep with tsleep
    
    Eliminate panic when re-setting a paused failpoint to pause
    (address of feq_mtx changes whilst in mtx_sleep, triggering
    assertion when reacquiring mtx).
    
    Reviewed by:    rlibby
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/2267
---
 sys/kern/kern_fail.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/sys/kern/kern_fail.c b/sys/kern/kern_fail.c
index 11871dfb0dca..40b02040a504 100644
--- a/sys/kern/kern_fail.c
+++ b/sys/kern/kern_fail.c
@@ -176,7 +176,6 @@ struct fail_point_setting {
 	STAILQ_ENTRY(fail_point_setting) fs_garbage_link;
 	struct fail_point_entry_queue fp_entry_queue;
 	struct fail_point * fs_parent;
-	struct mtx feq_mtx; /* Gives fail_point_pause something to do.  */
 };
 
 /**
@@ -248,7 +247,6 @@ fail_point_setting_new(struct fail_point *fp)
 	fs_new = fs_malloc();
 	fs_new->fs_parent = fp;
 	TAILQ_INIT(&fs_new->fp_entry_queue);
-	mtx_init(&fs_new->feq_mtx, "fail point entries", NULL, MTX_SPIN);
 
 	fail_point_setting_garbage_append(fs_new);
 
@@ -407,14 +405,13 @@ fail_point_drain(struct fail_point *fp, int expected_ref)
 }
 
 static inline void
-fail_point_pause(struct fail_point *fp, enum fail_point_return_code *pret,
-        struct mtx *mtx_sleep)
+fail_point_pause(struct fail_point *fp, enum fail_point_return_code *pret)
 {
 
 	if (fp->fp_pre_sleep_fn)
 		fp->fp_pre_sleep_fn(fp->fp_pre_sleep_arg);
 
-	msleep_spin(FP_PAUSE_CHANNEL(fp), mtx_sleep, "failpt", 0);
+	tsleep(FP_PAUSE_CHANNEL(fp), 0, "failpt", 0);
 
 	if (fp->fp_post_sleep_fn)
 		fp->fp_post_sleep_fn(fp->fp_post_sleep_arg);
@@ -624,9 +621,7 @@ fail_point_eval_nontrivial(struct fail_point *fp, int *return_value)
 			 * The sysctl layer actually truncates all entries after
 			 * a pause for this reason.
 			 */
-			mtx_lock_spin(&fp_setting->feq_mtx);
-			fail_point_pause(fp, &ret, &fp_setting->feq_mtx);
-			mtx_unlock_spin(&fp_setting->feq_mtx);
+			fail_point_pause(fp, &ret);
 			break;
 
 		case FAIL_POINT_YIELD: