Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Oct 2014 14:52:05 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272650 - head/sys/cam/ctl
Message-ID:  <201410061452.s96Eq5oH027478@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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;
 	}



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