Ever since a10d50f999, ZFS has mounted file systems in parallel when
importing a pool. It uses a fixed size of 512 for the thread pool. But
since c183d164aa, it has also imported pools in parallel. So the total
number of threads at one time is 513 * npools + 1. That can easily
exceed the system's limit on the number of threads per process, which
will cause one or more pools to be unable to allocate any worker
threads, forcing them to fallback to slow serial mounting . To
forestall that, manage the threadpool size in /sbin/zpool, not libzfs.
Use the same size (512), but divided by the number of pools.
This is a backwards-incompatible change to the libzfs abi.
Sponsored by: Axcient
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Wilson <gwilson@delphix.com>
Signed-off-by: Alan Somers <asomers@FreeBSD.org>
Closes#16178