]> granicus.if.org Git - zfs/commitdiff
Allow autoreplace even when enclosure LED sysfs entries don't exist
authorTony Hutter <hutter2@llnl.gov>
Fri, 4 Nov 2016 20:34:13 +0000 (13:34 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 4 Nov 2016 20:34:13 +0000 (13:34 -0700)
The previous autoreplace code assumed that if you were using autoreplace, then
you also had the enclosure SES driver loaded.  This could lead to autoreplace
not working if the SES driver wasn't loaded, or if it wasn't creating the
proper enclosure_device symlinks (which has happened).  This patch removes
that assumption.

Reviewed by: Don Brady <don.brady@intel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #5363

cmd/zed/agents/zfs_mod.c

index a073956b29cbdf6a8c484ffbdd8cc9c169eeb123..70548571af46d07cd0c7df17884d22d470dd95dd 100644 (file)
@@ -404,8 +404,8 @@ zfs_process_add(zpool_handle_t *zhp, nvlist_t *vdev, boolean_t labeled)
            nvlist_add_string(newvd, ZPOOL_CONFIG_DEVID, new_devid) != 0 ||
            (physpath != NULL && nvlist_add_string(newvd,
            ZPOOL_CONFIG_PHYS_PATH, physpath) != 0) ||
-           nvlist_add_string(newvd, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH,
-           enc_sysfs_path) != 0 ||
+           (enc_sysfs_path != NULL && nvlist_add_string(newvd,
+           ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH, enc_sysfs_path) != 0) ||
            nvlist_add_uint64(newvd, ZPOOL_CONFIG_WHOLE_DISK, wholedisk) != 0 ||
            nvlist_add_string(nvroot, ZPOOL_CONFIG_TYPE, VDEV_TYPE_ROOT) != 0 ||
            nvlist_add_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, &newvd,