From owner-svn-src-all@FreeBSD.ORG Thu May 2 14:14:58 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 67FD4AB0; Thu, 2 May 2013 14:14:58 +0000 (UTC) (envelope-from smh@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 487291F1E; Thu, 2 May 2013 14:14:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r42EEwCO077563; Thu, 2 May 2013 14:14:58 GMT (envelope-from smh@svn.freebsd.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r42EEwI9077561; Thu, 2 May 2013 14:14:58 GMT (envelope-from smh@svn.freebsd.org) Message-Id: <201305021414.r42EEwI9077561@svn.freebsd.org> From: Steven Hartland Date: Thu, 2 May 2013 14:14:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250179 - head/sys/cam/scsi X-SVN-Group: head 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.14 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: Thu, 02 May 2013 14:14:58 -0000 Author: smh Date: Thu May 2 14:14:57 2013 New Revision: 250179 URL: http://svnweb.freebsd.org/changeset/base/250179 Log: Update probe flow so that devices with lbp can also disable disksort. Ensure that delete_available is reset so re-probes after a media change, to one with different delete characteristics, will result in the correct methods being flagged as available. Make all ccb state changes use a consistent flow: * free() * xpt_release_ccb() * softc->state = * xpt_schedule() Reviewed by: mav Approved by: pjd (mentor) MFC after: 1 week Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Thu May 2 13:34:40 2013 (r250178) +++ head/sys/cam/scsi/scsi_da.c Thu May 2 14:14:57 2013 (r250179) @@ -2392,7 +2392,7 @@ out: if (!scsi_vpd_supported_page(periph, SVPD_BLOCK_LIMITS)) { /* Not supported skip to next probe */ - softc->state = DA_STATE_PROBE_ATA; + softc->state = DA_STATE_PROBE_BDC; goto skipstate; } @@ -2734,9 +2734,9 @@ dadone(struct cam_periph *periph, union * with the short version of the command. */ if (maxsector == 0xffffffff) { - softc->state = DA_STATE_PROBE_RC16; free(rdcap, M_SCSIDA); xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_RC16; xpt_schedule(periph, priority); return; } @@ -2838,9 +2838,9 @@ dadone(struct cam_periph *periph, union (error_code == SSD_CURRENT_ERROR) && (sense_key == SSD_KEY_ILLEGAL_REQUEST)))) { softc->flags &= ~DA_FLAG_CAN_RC16; - softc->state = DA_STATE_PROBE_RC; free(rdcap, M_SCSIDA); xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_RC; xpt_schedule(periph, priority); return; } else @@ -2897,36 +2897,39 @@ dadone(struct cam_periph *periph, union &softc->sysctl_task); xpt_announce_periph(periph, announce_buf); - if (lbp) { - /* - * Based on older SBC-3 spec revisions - * any of the UNMAP methods "may" be - * available via LBP given this flag so - * we flag all of them as availble and - * then remove those which further - * probes confirm aren't available - * later. - * - * We could also check readcap(16) p_type - * flag to exclude one or more invalid - * write same (X) types here - */ - dadeleteflag(softc, DA_DELETE_WS16, 1); - dadeleteflag(softc, DA_DELETE_WS10, 1); - dadeleteflag(softc, DA_DELETE_ZERO, 1); - dadeleteflag(softc, DA_DELETE_UNMAP, 1); - - softc->state = DA_STATE_PROBE_LBP; - xpt_release_ccb(done_ccb); - xpt_schedule(periph, priority); - return; - } } else { xpt_print(periph->path, "fatal error, " "could not acquire reference count\n"); } } + /* Ensure re-probe doesn't see old delete. */ + softc->delete_available = 0; + if (lbp) { + /* + * Based on older SBC-3 spec revisions + * any of the UNMAP methods "may" be + * available via LBP given this flag so + * we flag all of them as availble and + * then remove those which further + * probes confirm aren't available + * later. + * + * We could also check readcap(16) p_type + * flag to exclude one or more invalid + * write same (X) types here + */ + dadeleteflag(softc, DA_DELETE_WS16, 1); + dadeleteflag(softc, DA_DELETE_WS10, 1); + dadeleteflag(softc, DA_DELETE_ZERO, 1); + dadeleteflag(softc, DA_DELETE_UNMAP, 1); + + xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_LBP; + xpt_schedule(periph, priority); + return; + } + xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_BDC; xpt_schedule(periph, priority); @@ -2954,8 +2957,8 @@ dadone(struct cam_periph *periph, union if (lbp->flags & SVPD_LBP_UNMAP) { free(lbp, M_SCSIDA); - softc->state = DA_STATE_PROBE_BLK_LIMITS; xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_BLK_LIMITS; xpt_schedule(periph, priority); return; } @@ -2984,7 +2987,7 @@ dadone(struct cam_periph *periph, union free(lbp, M_SCSIDA); xpt_release_ccb(done_ccb); - softc->state = DA_STATE_PROBE_ATA; + softc->state = DA_STATE_PROBE_BDC; xpt_schedule(periph, priority); return; } @@ -3047,7 +3050,7 @@ dadone(struct cam_periph *periph, union free(block_limits, M_SCSIDA); xpt_release_ccb(done_ccb); - softc->state = DA_STATE_PROBE_ATA; + softc->state = DA_STATE_PROBE_BDC; xpt_schedule(periph, priority); return; } @@ -3084,8 +3087,8 @@ dadone(struct cam_periph *periph, union } free(bdc, M_SCSIDA); - softc->state = DA_STATE_PROBE_ATA; xpt_release_ccb(done_ccb); + softc->state = DA_STATE_PROBE_ATA; xpt_schedule(periph, priority); return; }