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 <nathaniel.l.clark@intel.com>
Change-Id: I44765b0c2b7ea8b1c8c6d45a9107842b17623dbc
Reviewed-on: http://review.whamcloud.com/23210
Tested-by: Jenkins
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
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;
}