1 From a0767672aac01f41516550e3808ff72da893102f Mon Sep 17 00:00:00 2001
2 From: Georgy Yakovlev <gyakovlev@gentoo.org>
3 Date: Tue, 26 Nov 2019 12:07:36 -0800
4 Subject: [PATCH] backport udev timeout patch
6 https://github.com/zfsonlinux/zfs/commit/803884217f9b9b5fb235d7c5e78a809d271f6387
8 lib/libzfs/libzfs_import.c | 11 ++++++++++-
9 man/man8/zpool.8 | 6 ++++++
10 2 files changed, 16 insertions(+), 1 deletion(-)
12 diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c
13 index 9dbf207..cd08806 100644
14 --- a/lib/libzfs/libzfs_import.c
15 +++ b/lib/libzfs/libzfs_import.c
24 @@ -1594,17 +1595,25 @@ zpool_open_func(void *arg)
25 if (rn->rn_labelpaths) {
34 if (label_paths(rn->rn_hdl, rn->rn_config, &path, &devid))
37 + env = getenv("ZPOOL_IMPORT_UDEV_TIMEOUT_MS");
38 + if ((env == NULL) || sscanf(env, "%d", &timeout) != 1 ||
40 + timeout = DISK_LABEL_WAIT;
44 * Allow devlinks to stabilize so all paths are available.
46 - zpool_label_disk_wait(rn->rn_name, DISK_LABEL_WAIT);
47 + zpool_label_disk_wait(rn->rn_name, timeout);
50 slice = zfs_alloc(hdl, sizeof (rdsk_node_t));
51 diff --git a/man/man8/zpool.8 b/man/man8/zpool.8
52 index 46e531e..10a19b5 100644
53 --- a/man/man8/zpool.8
54 +++ b/man/man8/zpool.8
55 @@ -2291,6 +2291,12 @@ Similar to the
59 +.Bl -tag -width "ZPOOL_IMPORT_UDEV_TIMEOUT_MS"
60 +.It Ev ZPOOL_IMPORT_UDEV_TIMEOUT_MS
61 +The maximum time in milliseconds that
63 +will wait for an expected device to be available.
65 .Bl -tag -width "ZPOOL_VDEV_NAME_GUID"
66 .It Ev ZPOOL_VDEV_NAME_GUID