31 lines
1.0 KiB
Diff
31 lines
1.0 KiB
Diff
commit d9bcb21179ccfea122f326aca4690afe0f7de0c6
|
|
Author: Mingming Cao <mmc@linux.vnet.ibm.com>
|
|
Date: Mon Mar 1 21:34:34 2021 -0800
|
|
|
|
hcnmgr: Wait for sysfs device ready when looking up device name
|
|
|
|
At the time of calling ofpathname to look up for devicename, wait
|
|
for sysfs device ready. Otherwise, the OS may be in the middle of device
|
|
renaming.
|
|
|
|
Signed-off-by: Mingming Cao <mmc@linux.vnet.ibm.com>
|
|
[tyreld: fixed up commit log]
|
|
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
|
|
|
|
diff --git a/scripts/hcnmgr b/scripts/hcnmgr
|
|
index c95edba..0d20e7d 100644
|
|
--- a/scripts/hcnmgr
|
|
+++ b/scripts/hcnmgr
|
|
@@ -241,7 +241,10 @@ get_dev_hcn() {
|
|
# Let's retry a few times.
|
|
while [ $wait != 0 ]; do
|
|
if DEVNAME=$(ofpathname -l "$(echo "$1" | sed -e "s/\/proc\/device-tree//")" 2>/dev/null); then
|
|
- break
|
|
+ if [ -e /sys/class/net/"$DEVNAME" ]; then
|
|
+ hcnlog DEBUG "ofpathname waiting for /sys/class/net device $DEVNAME ready"
|
|
+ break
|
|
+ fi
|
|
fi
|
|
|
|
hcnlog DEBUG "ofpathname return $?, devname is $DEVNAME rety counter $wait"
|