Skip to content

Commit 65a736b

Browse files
tonyhutterbehlendorf
authored andcommitted
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
1 parent 449705d commit 65a736b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/libzfs/libzfs_import.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ update_vdev_config_dev_strs(nvlist_t *nv)
476476
!strncasecmp(env, "YES", 3) || !strncasecmp(env, "ON", 2))) {
477477
(void) nvlist_remove_all(nv, ZPOOL_CONFIG_DEVID);
478478
(void) nvlist_remove_all(nv, ZPOOL_CONFIG_PHYS_PATH);
479-
(void) nvlist_remove_all(nv, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH);
480479
return;
481480
}
482481

@@ -504,6 +503,9 @@ update_vdev_config_dev_strs(nvlist_t *nv)
504503
if (spath)
505504
nvlist_add_string(nv, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH,
506505
spath);
506+
else
507+
nvlist_remove_all(nv, ZPOOL_CONFIG_VDEV_ENC_SYSFS_PATH);
508+
507509
free(upath);
508510
free(spath);
509511
} else {

0 commit comments

Comments
 (0)