svn commit: r272798 - stable/10/sys/cam/ctl

Alexander Motin mav at FreeBSD.org
Thu Oct 9 05:28:12 UTC 2014


Author: mav
Date: Thu Oct  9 05:28:11 2014
New Revision: 272798
URL: https://svnweb.freebsd.org/changeset/base/272798

Log:
  MFC r272650: Set CAM_SIM_QUEUED flag before calling ctl_queue() to avoid race.
  
  PR:		194128
  Submitted by:	Scott M. Ferris <smferris at gmail.com>
  Sponsored by:	EMC/Isilon Storage Division

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

Modified: stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c	Thu Oct  9 05:17:47 2014	(r272797)
+++ stable/10/sys/cam/ctl/ctl_frontend_cam_sim.c	Thu Oct  9 05:28:11 2014	(r272798)
@@ -609,14 +609,16 @@ cfcs_action(struct cam_sim *sim, union c
 		bcopy(csio->cdb_io.cdb_bytes, io->scsiio.cdb,
 		      io->scsiio.cdb_len);
 
+		ccb->ccb_h.status |= CAM_SIM_QUEUED;
 		err = ctl_queue(io);
 		if (err != CTL_RETVAL_COMPLETE) {
 			printf("%s: func %d: error %d returned by "
 			       "ctl_queue()!\n", __func__,
 			       ccb->ccb_h.func_code, err);
 			ctl_free_io(io);
-		} else {
-			ccb->ccb_h.status |= CAM_SIM_QUEUED;
+			ccb->ccb_h.status = CAM_REQ_INVALID;
+			xpt_done(ccb);
+			return;
 		}
 		break;
 	}


More information about the svn-src-all mailing list