Skip to content

Commit

Permalink
libzfs: Fix mounting datasets under thread limit pressure
Browse files Browse the repository at this point in the history
During parallel zpool import, /sbin/zpool will create a separate thread
pool for each pool, used to mount that pool's datasets.  If the total
thread count exceed's the system's limit on threads per process, then
tpool_dispatch may fail.  If it does, directly execute the mount
operation instead.

Sponsored by:	Axcient
Signed-off-by:	Alan Somers <[email protected]>
Fixes openzfs#16172
  • Loading branch information
asomers committed May 8, 2024
1 parent 075068c commit 829a843
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/libzfs/libzfs_mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,10 @@ zfs_dispatch_mount(libzfs_handle_t *hdl, zfs_handle_t **handles,
mnt_param->mnt_func = func;
mnt_param->mnt_data = data;

(void) tpool_dispatch(tp, zfs_mount_task, (void*)mnt_param);
if (tpool_dispatch(tp, zfs_mount_task, (void*)mnt_param)) {
/* Could not dispatch to thread pool; execute directly */
zfs_mount_task((void*)mnt_param);
}
}

/*
Expand Down

0 comments on commit 829a843

Please sign in to comment.