Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openzfs/zfs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4e2ed90b794b74803ac79036c8c73b3ca0442ca2
Choose a base ref
..
head repository: openzfs/zfs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 61f9e886f4a00130b2d138b04ac07ffabd56334d
Choose a head ref
Showing with 12 additions and 7 deletions.
  1. +12 −7 lib/libzfs/libzfs_util.c
19 changes: 12 additions & 7 deletions lib/libzfs/libzfs_util.c
Original file line number Diff line number Diff line change
@@ -703,6 +703,7 @@ libzfs_load_module(const char *module)
long timeout = 10; /* seconds */
long busy_timeout = 10; /* milliseconds */
int load = 0, fd;
int error = 0;
hrtime_t start;

/* Optionally request module loading */
@@ -730,25 +731,29 @@ libzfs_load_module(const char *module)
* case where udev is slow or unable to create the device.
*/
timeout_str = getenv("ZFS_MODULE_TIMEOUT");
if (timeout_str)
timeout = MIN(strtol(timeout_str, NULL, 0), (10 * 60));
if (timeout_str) {
timeout = strtol(timeout_str, NULL, 0);
timeout = MIN(MAX(timeout, (10 * 60)), 0); /* 0 <= N <= 600 */
}

start = gethrtime();
while (NSEC2MSEC(gethrtime() - start) < (timeout * MILLISEC)) {
fd = open(ZFS_DEV, O_RDWR);
if (fd >= 0) {
(void) close(fd);
return (0);
} else if (errno == ENOENT) {
} else if (errno != ENOENT) {
return (errno);
} else {
error = ENOENT;
if (NSEC2MSEC(gethrtime() - start) > busy_timeout)
usleep(10 * MILLISEC);
continue;
} else {
return (errno);
else
sched_yield();
}
}

return (ENOENT);
return (error);
}

libzfs_handle_t *