Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce and handle EAGAIN errors on AIO label reads #16551

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion lib/libzutil/zutil_import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,7 @@ zpool_read_label(int fd, nvlist_t **config, int *num_labels)
* Try the slow method.
*/
zfs_fallthrough;
case EAGAIN:
case EOPNOTSUPP:
case ENOSYS:
do_slow = B_TRUE;
Expand Down Expand Up @@ -1464,7 +1465,21 @@ zpool_find_import_impl(libpc_handle_t *hdl, importargs_t *iarg,
* validating labels, a large number of threads can be used due to
* minimal contention.
*/
t = tpool_create(1, 2 * sysconf(_SC_NPROCESSORS_ONLN), 0, NULL);
long threads = 2 * sysconf(_SC_NPROCESSORS_ONLN);
#ifdef HAVE_AIO_H
long am;
#ifdef _SC_AIO_LISTIO_MAX
am = sysconf(_SC_AIO_LISTIO_MAX);
if (am >= VDEV_LABELS)
threads = MIN(threads, am / VDEV_LABELS);
#endif
#ifdef _SC_AIO_MAX
am = sysconf(_SC_AIO_MAX);
if (am >= VDEV_LABELS)
threads = MIN(threads, am / VDEV_LABELS);
#endif
#endif
t = tpool_create(1, threads, 0, NULL);
for (slice = avl_first(cache); slice;
(slice = avl_walk(cache, slice, AVL_AFTER)))
(void) tpool_dispatch(t, zpool_open_func, slice);
Expand Down
Loading