zfs/lib/libzutil
Alexander Motin 3014dcb762
Reduce and handle EAGAIN errors on AIO label reads
At least FreeBSD has a limit of 256 simultaneous AIO requests per
process. Attempt to issue more results in EAGAIN errors. Since we
issue 4 requests per disk/partition from 2xCPUs threads, it is
quite easy to reach that limit on large systems, that results in
random pool import failures.  It annoyed me for quite a while on
a system with 64 CPUs and 70+ partitioned disks.

This patch from one side limits the number of threads to avoid the
error, while from another should softly fall back to sync reads in
case of error.  It takes into account _SC_AIO_MAX as a system-wide
AIO limit and _SC_AIO_LISTIO_MAX as a closest value to per-process
limit.  The last not exactly right, but it is the best I found.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #16551
2024-09-21 10:36:25 -07:00
..
os Fix the FreeBSD userspace build (#15716) 2023-12-27 12:17:53 -08:00
Makefile.am Use setproctitle to report progress of zfs send 2023-01-17 10:17:35 -08:00
zutil_device_path.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zutil_import.c Reduce and handle EAGAIN errors on AIO label reads 2024-09-21 10:36:25 -07:00
zutil_import.h nvpair: Constify string functions 2023-03-14 15:25:50 -07:00
zutil_nicenum.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zutil_pool.c zpool: Add slot power control, print power status 2023-12-21 10:53:16 -08:00