Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:07:50 -0000
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r346291 - stable/11/sys/cam
Message-ID:  <201904161832.x3GIW7KI067441@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Apr 16 18:32:07 2019
New Revision: 346291
URL: https://svnweb.freebsd.org/changeset/base/346291

Log:
  MFC r345805: Unify SCSI_STATUS_BUSY retry handling with other cases.
  
   - Do not retry if periph was invalidated.
   - Do not decrement retry_count if already zero.
   - Report action_string when applicable.

Modified:
  stable/11/sys/cam/cam_periph.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/cam_periph.c
==============================================================================
--- stable/11/sys/cam/cam_periph.c	Tue Apr 16 18:31:40 2019	(r346290)
+++ stable/11/sys/cam/cam_periph.c	Tue Apr 16 18:32:07 2019	(r346291)
@@ -1383,6 +1383,7 @@ camperiphscsistatuserror(union ccb *ccb, union ccb **o
     int *openings, u_int32_t *relsim_flags,
     u_int32_t *timeout, u_int32_t *action, const char **action_string)
 {
+	struct cam_periph *periph;
 	int error;
 
 	switch (ccb->csio.scsi_status) {
@@ -1465,14 +1466,21 @@ camperiphscsistatuserror(union ccb *ccb, union ccb **o
 		 * Restart the queue after either another
 		 * command completes or a 1 second timeout.
 		 */
-		if ((sense_flags & SF_RETRY_BUSY) != 0 ||
-		    (ccb->ccb_h.retry_count--) > 0) {
+		periph = xpt_path_periph(ccb->ccb_h.path);
+		if (periph->flags & CAM_PERIPH_INVALID) {
+			error = EIO;
+			*action_string = "Periph was invalidated";
+		} else if ((sense_flags & SF_RETRY_BUSY) != 0 ||
+		    ccb->ccb_h.retry_count > 0) {
+			if ((sense_flags & SF_RETRY_BUSY) == 0)
+				ccb->ccb_h.retry_count--;
 			error = ERESTART;
 			*relsim_flags = RELSIM_RELEASE_AFTER_TIMEOUT
 				      | RELSIM_RELEASE_AFTER_CMDCMPLT;
 			*timeout = 1000;
 		} else {
 			error = EIO;
+			*action_string = "Retries exhausted";
 		}
 		break;
 	case SCSI_STATUS_RESERV_CONFLICT:





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904161832.x3GIW7KI067441>