From owner-svn-src-all@freebsd.org Wed Jun 24 09:06:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C5D09151D1; Wed, 24 Jun 2015 09:06:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D46F1023; Wed, 24 Jun 2015 09:06:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5O96DUk021752; Wed, 24 Jun 2015 09:06:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5O96Dk2021751; Wed, 24 Jun 2015 09:06:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201506240906.t5O96Dk2021751@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 24 Jun 2015 09:06:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r284748 - head/sys/dev/isp 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.20 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: Wed, 24 Jun 2015 09:06:13 -0000 Author: mav Date: Wed Jun 24 09:06:12 2015 New Revision: 284748 URL: https://svnweb.freebsd.org/changeset/base/284748 Log: Fix reported_gone setting, missed in some cases. This makes driver better track reported CAM_SEL_TIMEOUTs to properly report device reappearance later. This fixes target 0 not reappearing after initiator mode disabled and then reenabled. MFC after: 3 days Modified: head/sys/dev/isp/isp_freebsd.c Modified: head/sys/dev/isp/isp_freebsd.c ============================================================================== --- head/sys/dev/isp/isp_freebsd.c Wed Jun 24 06:25:20 2015 (r284747) +++ head/sys/dev/isp/isp_freebsd.c Wed Jun 24 09:06:12 2015 (r284748) @@ -4943,6 +4943,8 @@ isp_action(struct cam_sim *sim, union cc isp = (ispsoftc_t *)cam_sim_softc(sim); mtx_assert(&isp->isp_lock, MA_OWNED); + isp_prt(isp, ISP_LOGDEBUG2, "isp_action code %x", ccb->ccb_h.func_code); + ISP_PCMD(ccb) = NULL; if (isp->isp_state != ISP_RUNSTATE && ccb->ccb_h.func_code == XPT_SCSI_IO) { isp_init(isp); @@ -4950,15 +4952,12 @@ isp_action(struct cam_sim *sim, union cc /* * Lie. Say it was a selection timeout. */ - ccb->ccb_h.status = CAM_SEL_TIMEOUT | CAM_DEV_QFRZN; - xpt_freeze_devq(ccb->ccb_h.path, 1); - xpt_done(ccb); + ccb->ccb_h.status = CAM_SEL_TIMEOUT; + isp_done((struct ccb_scsiio *) ccb); return; } isp->isp_state = ISP_RUNSTATE; } - isp_prt(isp, ISP_LOGDEBUG2, "isp_action code %x", ccb->ccb_h.func_code); - ISP_PCMD(ccb) = NULL; switch (ccb->ccb_h.func_code) { case XPT_SCSI_IO: /* Execute the requested I/O operation */ @@ -4969,7 +4968,7 @@ isp_action(struct cam_sim *sim, union cc if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0) { if ((ccb->ccb_h.flags & CAM_CDB_PHYS) != 0) { ccb->ccb_h.status = CAM_REQ_INVALID; - xpt_done(ccb); + isp_done((struct ccb_scsiio *) ccb); break; } } @@ -4992,6 +4991,7 @@ isp_action(struct cam_sim *sim, union cc isp_prt(isp, ISP_LOGWARN, "out of PCMDs"); cam_freeze_devq(ccb->ccb_h.path); cam_release_devq(ccb->ccb_h.path, RELSIM_RELEASE_AFTER_TIMEOUT, 0, 250, 0); + ccb->ccb_h.status = CAM_REQUEUE_REQ; xpt_done(ccb); break; } @@ -5024,10 +5024,8 @@ isp_action(struct cam_sim *sim, union cc } else { isp_prt(isp, ISP_LOGDEBUG0, "%d.%d downtime (%d) > lim (%d)", XS_TGT(ccb), XS_LUN(ccb), ISP_FC_PC(isp, bus)->loop_down_time, lim); } - ccb->ccb_h.status = CAM_SEL_TIMEOUT|CAM_DEV_QFRZN; - xpt_freeze_devq(ccb->ccb_h.path, 1); - isp_free_pcmd(isp, ccb); - xpt_done(ccb); + ccb->ccb_h.status = CAM_SEL_TIMEOUT; + isp_done((struct ccb_scsiio *) ccb); break; } isp_prt(isp, ISP_LOGDEBUG0, "%d.%d retry later", XS_TGT(ccb), XS_LUN(ccb)); @@ -5646,7 +5644,7 @@ isp_done(XS_T *sccb) * gone. If it reappears, we'll need to issue a * rescan. */ - if (hdlidx > 0 && hdlidx < MAX_FC_TARG) + if (hdlidx >= 0 && hdlidx < MAX_FC_TARG) fcp->portdb[hdlidx].reported_gone = 1; } if ((sccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { @@ -5659,9 +5657,11 @@ isp_done(XS_T *sccb) xpt_print(sccb->ccb_h.path, "cam completion status 0x%x\n", sccb->ccb_h.status); } - if (callout_active(&PISP_PCMD(sccb)->wdog)) - callout_stop(&PISP_PCMD(sccb)->wdog); - isp_free_pcmd(isp, (union ccb *) sccb); + if (ISP_PCMD(sccb)) { + if (callout_active(&PISP_PCMD(sccb)->wdog)) + callout_stop(&PISP_PCMD(sccb)->wdog); + isp_free_pcmd(isp, (union ccb *) sccb); + } xpt_done((union ccb *) sccb); }