Patchwork [5/5] ofpath: Handle disk devices with no sd node

login
register
mail settings
Submitter Brian King
Date Aug. 23, 2011, 2:45 p.m.
Message ID <201108231445.p7NEjSCL019789@d03av01.boulder.ibm.com>
Download mbox | patch
Permalink /patch/111121/
State Accepted
Headers show

Comments

Brian King - Aug. 23, 2011, 2:45 p.m.
Some storage boxes report a direct access device at LUN 31
which does not actually result in an sd device being attached.
Skip over these devices when parsing /proc/scsi/scsi.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---

 ybin/ofpath |   25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

Patch

diff -puN ybin/ofpath~ofpath_nosd ybin/ofpath
--- yaboot/ybin/ofpath~ofpath_nosd	2011-06-24 13:56:39.000000000 -0500
+++ yaboot-bjking1/ybin/ofpath	2011-07-11 08:51:25.000000000 -0500
@@ -285,17 +285,20 @@  scsiinfo()
 	[ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVHOST=$DEVHOST"
 
 	if [ "$DEVTYPE" = "Direct-Access" ] || [ "$DEVTYPE" = "Direct-Access-RBC" ] ; then
-	    DEVCOUNT="$(($DEVCOUNT + 1))"
-	    [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVCOUNT=$DEVCOUNT"
-	    if [ "$SUBDEV" = "$DEVCOUNT" ] ; then
-		DEVICE_HOST=$DEVHOST
-		DEVICE_BUS=$DEVBUS
-		DEVICE_ID=$DEVID
-		DEVICE_LUN=$DEVLUN
-		[ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVICE_HOST=$DEVICE_HOST"
-		break
-	    fi
-	fi
+	    ls /sys/bus/scsi/devices/$DEVHOST:$DEVBUS:$DEVID:$DEVLUN/scsi_disk* > /dev/null 2>&1
+	    if [ $? -eq 0 ] ; then
+                DEVCOUNT="$(($DEVCOUNT + 1))"
+                [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVCOUNT=$DEVCOUNT"
+                if [ "$SUBDEV" = "$DEVCOUNT" ] ; then
+                        DEVICE_HOST=$DEVHOST
+                        DEVICE_BUS=$DEVBUS
+                        DEVICE_ID=$DEVID
+                        DEVICE_LUN=$DEVLUN
+                        [ "$DEBUG" = 1 ] && echo 1>&2 "$PRG: DEBUG: DEVICE_HOST=$DEVICE_HOST"
+                        break
+                fi
+            fi
+        fi
     done
 
     ## figure out what the scsi driver is, it is /proc/scsi/dirname.