From owner-svn-src-head@FreeBSD.ORG Sat Jan 19 03:19:40 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C3533976; Sat, 19 Jan 2013 03:19:40 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 9294F81C; Sat, 19 Jan 2013 03:19:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r0J3Jeps056379; Sat, 19 Jan 2013 03:19:40 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r0J3Jeu0056377; Sat, 19 Jan 2013 03:19:40 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <201301190319.r0J3Jeu0056377@svn.freebsd.org> From: Alexander Kabaev Date: Sat, 19 Jan 2013 03:19:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245647 - in head/sys: cam/scsi dev/usb/storage X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jan 2013 03:19:40 -0000 Author: kan Date: Sat Jan 19 03:19:39 2013 New Revision: 245647 URL: http://svnweb.freebsd.org/changeset/base/245647 Log: Do not pretend to have autosense data when no such data is available. Make umass return an error code if SCSI sense retrieval request has failed. Make sure scsi_error_action honors SF_NO_RETRY and SF_NO_RECOVERY in all cases, even if it cannot parse sense bytes. Reviewed by: hselasky (umass), scottl (cam) Modified: head/sys/cam/scsi/scsi_all.c head/sys/dev/usb/storage/umass.c Modified: head/sys/cam/scsi/scsi_all.c ============================================================================== --- head/sys/cam/scsi/scsi_all.c Sat Jan 19 03:13:04 2013 (r245646) +++ head/sys/cam/scsi/scsi_all.c Sat Jan 19 03:19:39 2013 (r245647) @@ -3071,16 +3071,15 @@ scsi_error_action(struct ccb_scsiio *csi SSQ_PRINT_SENSE; } } - if ((action & SS_MASK) >= SS_START && - (sense_flags & SF_NO_RECOVERY)) { - action &= ~SS_MASK; - action |= SS_FAIL; - } else if ((action & SS_MASK) == SS_RETRY && - (sense_flags & SF_NO_RETRY)) { - action &= ~SS_MASK; - action |= SS_FAIL; - } - + } + if ((action & SS_MASK) >= SS_START && + (sense_flags & SF_NO_RECOVERY)) { + action &= ~SS_MASK; + action |= SS_FAIL; + } else if ((action & SS_MASK) == SS_RETRY && + (sense_flags & SF_NO_RETRY)) { + action &= ~SS_MASK; + action |= SS_FAIL; } if ((sense_flags & SF_PRINT_ALWAYS) != 0) action |= SSQ_PRINT_SENSE; Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Sat Jan 19 03:13:04 2013 (r245646) +++ head/sys/dev/usb/storage/umass.c Sat Jan 19 03:19:39 2013 (r245647) @@ -2602,9 +2602,13 @@ umass_cam_sense_cb(struct umass_softc *s } } else { xpt_freeze_devq(ccb->ccb_h.path, 1); - ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR - | CAM_AUTOSNS_VALID | CAM_DEV_QFRZN; - ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; + if (key >= 0) { + ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR + | CAM_AUTOSNS_VALID | CAM_DEV_QFRZN; + ccb->csio.scsi_status = SCSI_STATUS_CHECK_COND; + } else + ccb->ccb_h.status = CAM_AUTOSENSE_FAIL + | CAM_DEV_QFRZN; } xpt_done(ccb); break;