summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Hutter <hutter2@llnl.gov>2021-10-29 15:33:34 -0700
committerTony Hutter <hutter2@llnl.gov>2021-11-12 16:31:55 -0800
commit92fcbe04bae11052191e46b3515041c3e27e7ae6 (patch)
tree35f6697def972527ca26af1c43876a928e1166fa
parentdfbc33a0e5298f2840144c3a29d053918a2dd944 (diff)
vdev_id: Fix PHY sorting
One of our developers noticed a bug in vdev_id where we were incorrectly sorting PHYs using alphabetical sorting (which usually works) instead of natural sorting (-v). For example: [port-0:0]# ls -d phy* phy-0:10 phy-0:11 phy-0:8 phy-0:9 [port-0:0]# ls -vd phy* phy-0:8 phy-0:9 phy-0:10 phy-0:11 This fixes the issue. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #12699
-rwxr-xr-xcmd/vdev_id/vdev_id2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/vdev_id/vdev_id b/cmd/vdev_id/vdev_id
index ab9d7326f..8cc4399a5 100755
--- a/cmd/vdev_id/vdev_id
+++ b/cmd/vdev_id/vdev_id
@@ -375,7 +375,7 @@ sas_handler() {
i=$((i + 1))
done
- PHY=$(ls -d "$port_dir"/phy* 2>/dev/null | head -1 | awk -F: '{print $NF}')
+ PHY=$(ls -vd "$port_dir"/phy* 2>/dev/null | head -1 | awk -F: '{print $NF}')
if [ -z "$PHY" ] ; then
PHY=0
fi