vdev_id: variable not getting expanded under map_slot()

Under function map_slot() variable passed as args
were not getting properly substituted or expanded.
This patch fixes the substitution issue.

Reviewed-by: Niklas Edmundsson <nikke@acc.umu.se>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Closes #11951 
Closes #11959
This commit is contained in:
Arshad Hussain 2021-04-30 02:28:49 +05:30 committed by Brian Behlendorf
parent 4ac37f8b2e
commit 910b43310f

View File

@ -147,8 +147,9 @@ map_slot() {
LINUX_SLOT=$1 LINUX_SLOT=$1
CHANNEL=$2 CHANNEL=$2
MAPPED_SLOT=$(awk '$1 == "slot" && $2 == "${LINUX_SLOT}" && \ MAPPED_SLOT=$(awk -v linux_slot="$LINUX_SLOT" -v channel="$CHANNEL" \
$4 ~ /^${CHANNEL}$|^$/ { print $3; exit}' $CONFIG) '$1 == "slot" && $2 == linux_slot && \
($4 ~ "^"channel"$" || $4 ~ /^$/) { print $3; exit}' $CONFIG)
if [ -z "$MAPPED_SLOT" ] ; then if [ -z "$MAPPED_SLOT" ] ; then
MAPPED_SLOT=$LINUX_SLOT MAPPED_SLOT=$LINUX_SLOT
fi fi
@ -163,7 +164,7 @@ map_channel() {
case $TOPOLOGY in case $TOPOLOGY in
"sas_switch") "sas_switch")
MAPPED_CHAN=$(awk -v port="$PORT" \ MAPPED_CHAN=$(awk -v port="$PORT" \
'$1 == "channel" && $2 == ${PORT} \ '$1 == "channel" && $2 == port \
{ print $3; exit }' $CONFIG) { print $3; exit }' $CONFIG)
;; ;;
"sas_direct"|"scsi") "sas_direct"|"scsi")