aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs
diff options
context:
space:
mode:
authorTony Hutter <[email protected]>2017-02-10 15:18:31 -0800
committerBrian Behlendorf <[email protected]>2017-02-10 15:18:31 -0800
commit65a736bc0df16561bac14bee6bf9a6752cf8bc39 (patch)
tree38ecdf8551d9186bce11bbbb59d68fe5fadbca73 /lib/libzfs
parent449705dbef3008f1cf69ea59276bd07720e4beb2 (diff)
Clear enclosure sysfs path from VDEV label when sysfs path isn't present
This clears vdev_enc_sysfs_path from the label if the VDEV's /sys/class/block/<dev>/device/enclosure_device path isn't present. This is important in the case where a disk that is labeled with vdev_enc_sysfs_path is pulled out and put into another enclosure. In that case, it's possible that the old sysfs path would be used to turn on the fault LED for the disk's old slot postion, assuming the new slot didn't have a LED sysfs entry. Reviewed-by: Don Brady <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #5524 Closes #5773
Diffstat (limited to 'lib/libzfs')
-rw-r--r--lib/libzfs/libzfs_import.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c
index 1e378321c..ce6584090 100644
--- a/lib/libzfs/libzfs_import.c
+++ b/lib/libzfs/libzfs_import.c
@@ -476,7 +476,6 @@ update_vdev_config_dev_strs(nvlist_t *nv)
!strncasecmp(env, "YES", 3) || !strncasecmp(env, "ON", 2))) {
(void) nvlist_remove_all(nv, ZPOOL_CONFIG_DEVID);
(void) nvlist_remove_all(nv, ZPOOL_CONFIG_PHYS_PATH);
- (void) nvlist_remove_all(nv, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH);
return;
}
@@ -504,6 +503,9 @@ update_vdev_config_dev_strs(nvlist_t *nv)
if (spath)
nvlist_add_string(nv, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH,
spath);
+ else
+ nvlist_remove_all(nv, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH);
+
free(upath);
free(spath);
} else {