From: Tony Hutter Date: Fri, 4 Nov 2016 20:34:13 +0000 (-0700) Subject: Allow autoreplace even when enclosure LED sysfs entries don't exist X-Git-Tag: zfs-0.7.0-rc3~95 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ad9de6d08f8c0261094d322a4507a5cbbb53e66;p=zfs Allow autoreplace even when enclosure LED sysfs entries don't exist 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 Reviewed-by: Brian Behlendorf Signed-off-by: Tony Hutter Closes #5363 --- diff --git a/cmd/zed/agents/zfs_mod.c b/cmd/zed/agents/zfs_mod.c index a073956b2..70548571a 100644 --- a/cmd/zed/agents/zfs_mod.c +++ b/cmd/zed/agents/zfs_mod.c @@ -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,