From patchwork Tue Apr 4 11:57:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 746763 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vy6tJ1Nzvz9s8S for ; Tue, 4 Apr 2017 21:58:00 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vy6tJ0T5czDqHV for ; Tue, 4 Apr 2017 21:58:00 +1000 (AEST) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vy6tC34hlzDq7c for ; Tue, 4 Apr 2017 21:57:55 +1000 (AEST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 176E77F6C8 for ; Tue, 4 Apr 2017 11:57:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 176E77F6C8 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 176E77F6C8 Received: from thh440s.str.redhat.com (dhcp-192-189.str.redhat.com [10.33.192.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id B949E5C6CA for ; Tue, 4 Apr 2017 11:57:52 +0000 (UTC) From: Thomas Huth To: slof@lists.ozlabs.org Date: Tue, 4 Apr 2017 13:57:51 +0200 Message-Id: <1491307071-19895-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 04 Apr 2017 11:57:53 +0000 (UTC) Subject: [SLOF] [PATCH] Fix "Unsupported PQ" problems in the scsi-disk open function X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" The open function of the scsi-disk code has a bug: If it encounters a Peripheral Qualifier != 0, it does not clean up the pointer to the INQUIRY buffer before exiting, so the stack is messed up afterwards and you get an ugly "Unknown Exception" before getting to the SLOF prompt. Also it's not a real error if the byte is set to 0x7f - this simply means that the "SCSI target device is not capable of supporting a peripheral device connected to this logical unit" (according to the SPC-3 standard). So in this case, we should not issue an error message, thus let's use the pointer to the INQUIRY buffer to check whether the PQ/PDT byte is 0x7f to fix both problems. Signed-off-by: Thomas Huth Reviewed-by: Nikunj A Dadhania --- slof/fs/scsi-disk.fs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/slof/fs/scsi-disk.fs b/slof/fs/scsi-disk.fs index 9c0a9c1..97d9892 100644 --- a/slof/fs/scsi-disk.fs +++ b/slof/fs/scsi-disk.fs @@ -323,8 +323,12 @@ CREATE cdb 10 allot \ Skip devices with PQ != 0 dup inquiry-data>peripheral c@ e0 and 0 <> IF - ." SCSI-DISK: Unsupported PQ != 0" cr - false EXIT + \ Ignore 7f, since this simply means that the target + \ is not supporting a peripheral device at this LUN. + inquiry-data>peripheral c@ 7f <> IF + ." SCSI-DISK: Unsupported PQ != 0" cr + THEN + false EXIT THEN inquiry-data>peripheral c@ CASE