git: 914064cf193b - releng/15.0 - fusefs: fix intermittency in the BadServer.ShortWrite test

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Thu, 06 Nov 2025 23:11:50 UTC
The branch releng/15.0 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=914064cf193bb696734b7e5a08e8a7e594c33507

commit 914064cf193bb696734b7e5a08e8a7e594c33507
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2025-10-14 02:18:48 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-11-06 23:10:55 +0000

    fusefs: fix intermittency in the BadServer.ShortWrite test
    
    This test implicitly depended on the order in which two threads
    completed.  If the test thread finished first, the test would pass.  But
    if the mock file system thread did, it would attempt to read from an
    unmounted file system, and fail.  As a result, the test would randomly
    fail once out of every several thousand executions.  Fix it by telling
    the mock file system's event loop to exit without attempting to read any
    more events.
    
    Approved by:    re (cperciva)
    Reported by:    Siva Mahadevan <me@svmhdvn.name>
    MFC after:      1 week
    Reviewed by:    Siva Mahadevan <me@svmhdvn.name>
    Differential Revision: https://reviews.freebsd.org/D53080
    
    (cherry picked from commit d1bd541b385d49d2ae3a8bad9df72779b606e208)
    (cherry picked from commit a1c3537148a59f6a1c86ebcb686b2e2c8e404b5f)
---
 tests/sys/fs/fusefs/bad_server.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/sys/fs/fusefs/bad_server.cc b/tests/sys/fs/fusefs/bad_server.cc
index af2ca146e431..c3d195735446 100644
--- a/tests/sys/fs/fusefs/bad_server.cc
+++ b/tests/sys/fs/fusefs/bad_server.cc
@@ -65,6 +65,11 @@ TEST_F(BadServer, ShortWrite)
 	out.header.unique = 0;			// Asynchronous notification
 	out.expected_errno = EINVAL;
 	m_mock->write_response(out);
+	/*
+	 * Tell the event loop to quit.  The kernel has already disconnected us
+	 * because of the short write.
+	 */
+	m_mock->m_quit = true;
 }
 
 /*