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 <smfer...@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;
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to