diff options
author | Tony Hutter <[email protected]> | 2021-10-20 15:48:04 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2021-10-20 15:48:04 -0700 |
commit | 1886cdfcfb970d57d4a2ae40b56d2dab2f029e2b (patch) | |
tree | 11690f8b2960dba11020cd48400550978e8be7d6 | |
parent | 6cb5e1e7591da20af3a15793e022345a73e40fb7 (diff) |
vdev_id: Fix enclosure_symlinks feature
The vdev_id.conf "enclosure_symlinks" option persistently creates
and maps /dev/by-enclosure symlinks to dynamic /dev/sg* devices.
This patch fixes two issues:
1. The enclosure_symlinks feature was accidentally broken in:
vdev_id: Support daisy-chained JBODs in multipath mode
2. Even when working, the feature numbered the enclosure
sequentially rather than by HBA port number. That meant that
if a port was down or didn't appear in sysfs, then the
enclosure_sumlinks numbers would be numbered wrong.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Arshad Hussain <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #12660
-rwxr-xr-x | cmd/vdev_id/vdev_id | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/vdev_id/vdev_id b/cmd/vdev_id/vdev_id index cad59c93f..ab9d7326f 100755 --- a/cmd/vdev_id/vdev_id +++ b/cmd/vdev_id/vdev_id @@ -622,8 +622,8 @@ enclosure_handler () { PCI_ID=$(echo "$PCI_ID_LONG" | sed -r 's/^[0-9]+://g') # Name our device according to vdev_id.conf (like "L0" or "U1"). - NAME=$(awk '/channel/{if ($1 == "channel" && $2 == "$PCI_ID" && \ - $3 == "$PORT_ID") {print ${4}int(count[$4])}; count[$4]++}' $CONFIG) + NAME=$(awk "/channel/{if (\$1 == \"channel\" && \$2 == \"$PCI_ID\" && \ + \$3 == \"$PORT_ID\") {print \$4\$3}}" $CONFIG) echo "${NAME}" } |