git: bc0d313bc84d - stable/14 - aio: if there is at least one aio thread, hide an error from aio_init_aioinfo()

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 12 Jul 2025 01:44:25 UTC
The branch stable/14 has been updated by kib:

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

commit bc0d313bc84d3ef11be8c77ee65fe89cac73183b
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2025-07-07 14:35:11 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-07-12 01:41:35 +0000

    aio: if there is at least one aio thread, hide an error from aio_init_aioinfo()
    
    (cherry picked from commit 0c38e3dbbf6eaa2755d34189149c9140cacd4bb1)
---
 sys/kern/vfs_aio.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index ff1e522f7cf2..a14865f6b20c 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -464,8 +464,15 @@ aio_init_aioinfo(struct proc *p)
 	error = 0;
 	while (num_aio_procs < MIN(target_aio_procs, max_aio_procs)) {
 		error = aio_newproc(NULL);
-		if (error != 0)
+		if (error != 0) {
+			/*
+			 * At least one worker is enough to have AIO
+			 * functional.  Clear error in that case.
+			 */
+			if (num_aio_procs > 0)
+				error = 0;
 			break;
+		}
 	}
 	return (error);
 }