From patchwork Tue Aug 23 14:45:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian King X-Patchwork-Id: 111121 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 341A6B70F5 for ; Wed, 24 Aug 2011 00:45:55 +1000 (EST) Received: from e8.ny.us.ibm.com (e8.ny.us.ibm.com [32.97.182.138]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "e8.ny.us.ibm.com", Issuer "GeoTrust SSL CA" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id 6427BB700E for ; Wed, 24 Aug 2011 00:45:53 +1000 (EST) Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by e8.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p7NEVo7j001601 for ; Tue, 23 Aug 2011 10:31:50 -0400 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p7NEjVIY214786 for ; Tue, 23 Aug 2011 10:45:32 -0400 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p7NEjU6m020005 for ; Tue, 23 Aug 2011 08:45:30 -0600 Received: from localhost.localdomain ([9.49.216.2]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p7NEjSCL019789; Tue, 23 Aug 2011 08:45:29 -0600 Message-Id: <201108231445.p7NEjSCL019789@d03av01.boulder.ibm.com> Subject: [PATCH 5/5] ofpath: Handle disk devices with no sd node To: yaboot-devel@lists.ozlabs.org From: Brian King Date: Tue, 23 Aug 2011 09:45:30 -0500 X-BeenThere: yaboot-devel@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical and development discussion regarding yaboot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: yaboot-devel-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: yaboot-devel-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org 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 --- ybin/ofpath | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) 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.