svn commit: r272650 - head/sys/cam/ctl

Alexander Motin mav at FreeBSD.org
Mon Oct 6 14:52:05 UTC 2014


Author: mav
Date: Mon Oct  6 14:52:04 2014
New Revision: 272650
URL: https://svnweb.freebsd.org/changeset/base/272650

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

Modified:
  head/sys/cam/ctl/ctl_frontend_cam_sim.c

Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c
==============================================================================
--- head/sys/cam/ctl/ctl_frontend_cam_sim.c	Mon Oct  6 14:43:02 2014	(r272649)
+++ head/sys/cam/ctl/ctl_frontend_cam_sim.c	Mon Oct  6 14:52:04 2014	(r272650)
@@ -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-head mailing list