Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Jun 2015 07:07:33 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r284794 - stable/10/sys/cam/ctl
Message-ID:  <201506250707.t5P77XUh086729@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Jun 25 07:07:32 2015
New Revision: 284794
URL: https://svnweb.freebsd.org/changeset/base/284794

Log:
  MFC r284622: Remove device queue freeze handling and replace it with dummy.
  
  At this point CTL has no known use case for device queue freezes.
  Same time existing (considered to be broken) code was found to cause
  modify-after-free issues.

Modified:
  stable/10/sys/cam/ctl/scsi_ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/scsi_ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/scsi_ctl.c	Thu Jun 25 07:06:24 2015	(r284793)
+++ stable/10/sys/cam/ctl/scsi_ctl.c	Thu Jun 25 07:07:32 2015	(r284794)
@@ -848,15 +848,6 @@ ctlfestart(struct cam_periph *periph, un
 				atio->ccb_h.target_lun = CAM_LUN_WILDCARD;
 			}
 
-			if ((atio->ccb_h.status & CAM_DEV_QFRZN) != 0) {
-				cam_release_devq(periph->path,
-						 /*relsim_flags*/0,
-						 /*reduction*/0,
-						 /*timeout*/0,
-						 /*getcount_only*/0);
-				atio->ccb_h.status &= ~CAM_DEV_QFRZN;
-			}
-
 			if (atio->ccb_h.func_code != XPT_ACCEPT_TARGET_IO) {
 				xpt_print(periph->path, "%s: func_code "
 					  "is %#x\n", __func__,
@@ -966,15 +957,6 @@ ctlfestart(struct cam_periph *periph, un
 	xpt_action(start_ccb);
 	cam_periph_lock(periph);
 
-	if ((atio->ccb_h.status & CAM_DEV_QFRZN) != 0) {
-		cam_release_devq(periph->path,
-				 /*relsim_flags*/0,
-				 /*reduction*/0,
-				 /*timeout*/0,
-				 /*getcount_only*/0);
-		atio->ccb_h.status &= ~CAM_DEV_QFRZN;
-	}
-
 	/*
 	 * If we still have work to do, ask for another CCB.
 	 */
@@ -1107,6 +1089,19 @@ ctlfedone(struct cam_periph *periph, uni
 	       done_ccb->ccb_h.func_code);
 #endif
 
+	/*
+	 * At this point CTL has no known use case for device queue freezes.
+	 * In case some SIM think different -- drop its freeze right here.
+	 */
+	if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) {
+		cam_release_devq(periph->path,
+				 /*relsim_flags*/0,
+				 /*reduction*/0,
+				 /*timeout*/0,
+				 /*getcount_only*/0);
+		done_ccb->ccb_h.status &= ~CAM_DEV_QFRZN;
+	}
+
 	softc = (struct ctlfe_lun_softc *)periph->softc;
 	bus_softc = softc->parent_softc;
 	mtx = cam_periph_mtx(periph);
@@ -1417,12 +1412,9 @@ ctlfedone(struct cam_periph *periph, uni
 		union ctl_io *io;
 		struct ccb_immediate_notify *inot;
 		cam_status status;
-		int frozen, send_ctl_io;
+		int send_ctl_io;
 
 		inot = &done_ccb->cin1;
-
-		frozen = (done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0;
-
 		printf("%s: got XPT_IMMEDIATE_NOTIFY status %#x tag %#x "
 		       "seq %#x\n", __func__, inot->ccb_h.status,
 		       inot->tag_id, inot->seq_id);
@@ -1524,14 +1516,6 @@ ctlfedone(struct cam_periph *periph, uni
 			done_ccb->ccb_h.func_code = XPT_NOTIFY_ACKNOWLEDGE;
 			xpt_action(done_ccb);
 		}
-
-		if (frozen != 0) {
-			cam_release_devq(periph->path,
-					 /*relsim_flags*/ 0,
-					 /*opening reduction*/ 0,
-					 /*timeout*/ 0,
-					 /*getcount_only*/ 0);
-		}
 		break;
 	}
 	case XPT_NOTIFY_ACKNOWLEDGE:



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