From 3092629deca3988f7b74e4c2877601688828462a Mon Sep 17 00:00:00 2001 From: Nathaniel Clark Date: Mon, 17 Oct 2016 12:26:22 -0400 Subject: [PATCH] LU-8713 utils: Try loading zfs.ko during zfs_init Newer version of zfs (0.6.5.8 and 0.7.0) do not autoload zfs module at boot nor do they load it during libzfs_init(), so try loading it during initialization. Signed-off-by: Nathaniel Clark Change-Id: I44765b0c2b7ea8b1c8c6d45a9107842b17623dbc Reviewed-on: http://review.whamcloud.com/23210 Tested-by: Jenkins Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/utils/mount_utils_zfs.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lustre/utils/mount_utils_zfs.c b/lustre/utils/mount_utils_zfs.c index 592f18d..755c218 100644 --- a/lustre/utils/mount_utils_zfs.c +++ b/lustre/utils/mount_utils_zfs.c @@ -664,12 +664,23 @@ int zfs_init(void) g_zfs = libzfs_init(); if (g_zfs == NULL) { - fprintf(stderr, "Failed to initialize ZFS library\n"); - ret = EINVAL; - } else { - osd_zfs_setup = 1; + /* Try to load zfs.ko and retry libzfs_init() */ + + ret = system("/sbin/modprobe -q zfs"); + + if (ret == 0) { + g_zfs = libzfs_init(); + if (g_zfs == NULL) + ret = EINVAL; + } } + if (ret == 0) + osd_zfs_setup = 1; + + else + fprintf(stderr, "Failed to initialize ZFS library: %d\n", ret); + return ret; } -- 1.8.3.1