aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzutil
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libzutil')
-rw-r--r--lib/libzutil/os/linux/zutil_import_os.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libzutil/os/linux/zutil_import_os.c b/lib/libzutil/os/linux/zutil_import_os.c
index 811eae397..e51004edc 100644
--- a/lib/libzutil/os/linux/zutil_import_os.c
+++ b/lib/libzutil/os/linux/zutil_import_os.c
@@ -53,6 +53,7 @@
#include <libgen.h>
#include <stddef.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -181,17 +182,25 @@ zpool_open_func(void *arg)
if (rn->rn_labelpaths) {
char *path = NULL;
char *devid = NULL;
+ char *env = NULL;
rdsk_node_t *slice;
avl_index_t where;
+ int timeout;
int error;
if (label_paths(rn->rn_hdl, rn->rn_config, &path, &devid))
return;
+ env = getenv("ZPOOL_IMPORT_UDEV_TIMEOUT_MS");
+ if ((env == NULL) || sscanf(env, "%d", &timeout) != 1 ||
+ timeout < 0) {
+ timeout = DISK_LABEL_WAIT;
+ }
+
/*
* Allow devlinks to stabilize so all paths are available.
*/
- zpool_label_disk_wait(rn->rn_name, DISK_LABEL_WAIT);
+ zpool_label_disk_wait(rn->rn_name, timeout);
if (path != NULL) {
slice = zutil_alloc(hdl, sizeof (rdsk_node_t));