From owner-svn-src-all@freebsd.org Tue Apr 24 13:52:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDB26FA51FC; Tue, 24 Apr 2018 13:52:39 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CA4769473; Tue, 24 Apr 2018 13:52:39 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 778E513FCC; Tue, 24 Apr 2018 13:52:39 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3ODqdkT030868; Tue, 24 Apr 2018 13:52:39 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3ODqdPO030867; Tue, 24 Apr 2018 13:52:39 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201804241352.w3ODqdPO030867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Tue, 24 Apr 2018 13:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r332933 - stable/10/sys/cam/scsi X-SVN-Group: stable-10 X-SVN-Commit-Author: ken X-SVN-Commit-Paths: stable/10/sys/cam/scsi X-SVN-Commit-Revision: 332933 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Apr 2018 13:52:40 -0000 Author: ken Date: Tue Apr 24 13:52:39 2018 New Revision: 332933 URL: https://svnweb.freebsd.org/changeset/base/332933 Log: MFC r332458: ------------------------------------------------------------------------ r332458 | ken | 2018-04-12 15:21:18 -0600 (Thu, 12 Apr 2018) | 34 lines Handle Programmable Early Warning for control commands in sa(4). When the tape position is inside the Early Warning area, the tape drive will return a sense key of NO SENSE, and an ASC/ASCQ of 0x00,0x02, which means: End-of-partition/medium detected". If this was in response to a control command like WRITE FILEMARKS, we correctly translate this as informational status and return 0 from saerror(). Programmable Early Warning should be handled the same way, but we weren't handling it that way. As a result, if a PEW status (sense key of NO SENSE, ASC/ASCQ of 0x00,0x07, "Programmable early warning detected") came back in response to a WRITE FILEMARKS, we returned an error. The impact of this was that if an application was writing to a sa(4) device, and a PEW area was set (in the Device Configuration Extension subpage -- mode page 0x10, subpage 1), and a filemark needed to be written on close, we could wind up returning an error to the user on close because of a "failure" to write the filemarks. It actually isn't a failure, but rather just a status report from the drive, and shouldn't be treated as a failure. sys/cam/scsi/scsi_sa.c: For control commands in saerror(), treat asc/ascq 0x00,0x07 the same as 0x00,{0-5} -- not an error. Return 0, since the command actually did succeed. Reported by: Dr. Andreas Haakh Tested by: Dr. Andreas Haakh Sponsored by: Spectra Logic ------------------------------------------------------------------------ Modified: stable/10/sys/cam/scsi/scsi_sa.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/scsi/scsi_sa.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_sa.c Tue Apr 24 13:44:19 2018 (r332932) +++ stable/10/sys/cam/scsi/scsi_sa.c Tue Apr 24 13:52:39 2018 (r332933) @@ -3453,12 +3453,13 @@ saerror(union ccb *ccb, u_int32_t cflgs, u_int32_t sfl break; } /* - * If this was just EOM/EOP, Filemark, Setmark or ILI detected - * on a non read/write command, we assume it's not an error - * and propagate the residule and return. + * If this was just EOM/EOP, Filemark, Setmark, ILI or + * PEW detected on a non read/write command, we assume + * it's not an error and propagate the residual and return. */ - if ((aqvalid && asc == 0 && ascq > 0 && ascq <= 5) || - (aqvalid == 0 && sense_key == SSD_KEY_NO_SENSE)) { + if ((aqvalid && asc == 0 && ((ascq > 0 && ascq <= 5) + || (ascq == 0x07))) + || (aqvalid == 0 && sense_key == SSD_KEY_NO_SENSE)) { csio->resid = resid; QFRLS(ccb); return (0);