[Midnightbsd-cvs] src [8750] trunk/sys/cam: XPT_DEV_MATCH is probably the only xpt_action() method that is called without holding SIM lock.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Sep 25 22:35:36 EDT 2016
Revision: 8750
http://svnweb.midnightbsd.org/src/?rev=8750
Author: laffer1
Date: 2016-09-25 22:35:36 -0400 (Sun, 25 Sep 2016)
Log Message:
-----------
XPT_DEV_MATCH is probably the only xpt_action() method that is called without holding SIM lock.
Modified Paths:
--------------
trunk/sys/cam/cam_xpt.c
trunk/sys/cam/scsi/scsi_enc_ses.c
Modified: trunk/sys/cam/cam_xpt.c
===================================================================
--- trunk/sys/cam/cam_xpt.c 2016-09-26 02:34:48 UTC (rev 8749)
+++ trunk/sys/cam/cam_xpt.c 2016-09-26 02:35:36 UTC (rev 8750)
@@ -582,7 +582,9 @@
/*
* This is an immediate CCB, we can send it on directly.
*/
+ CAM_SIM_LOCK(xpt_path_sim(xpt_periph->path));
xpt_action(inccb);
+ CAM_SIM_UNLOCK(xpt_path_sim(xpt_periph->path));
/*
* Map the buffers back into user space.
@@ -2815,6 +2817,11 @@
position_type = CAM_DEV_POS_PDRV;
}
+ /*
+ * Note that we drop the SIM lock here, because the EDT
+ * traversal code needs to do its own locking.
+ */
+ CAM_SIM_UNLOCK(xpt_path_sim(cdm->ccb_h.path));
switch(position_type & CAM_DEV_POS_TYPEMASK) {
case CAM_DEV_POS_EDT:
xptedtmatch(cdm);
@@ -2826,6 +2833,7 @@
cdm->status = CAM_DEV_MATCH_ERROR;
break;
}
+ CAM_SIM_LOCK(xpt_path_sim(cdm->ccb_h.path));
if (cdm->status == CAM_DEV_MATCH_ERROR)
start_ccb->ccb_h.status = CAM_REQ_CMP_ERR;
Modified: trunk/sys/cam/scsi/scsi_enc_ses.c
===================================================================
--- trunk/sys/cam/scsi/scsi_enc_ses.c 2016-09-26 02:34:48 UTC (rev 8749)
+++ trunk/sys/cam/scsi/scsi_enc_ses.c 2016-09-26 02:35:36 UTC (rev 8750)
@@ -901,9 +901,10 @@
device_pattern->data.devid_pat.id_len);
memset(&cdm, 0, sizeof(cdm));
- if (xpt_create_path(&cdm.ccb_h.path, /*periph*/NULL, CAM_XPT_PATH_ID,
- CAM_TARGET_WILDCARD,
- CAM_LUN_WILDCARD) != CAM_REQ_CMP)
+ if (xpt_create_path_unlocked(&cdm.ccb_h.path, /*periph*/NULL,
+ CAM_XPT_PATH_ID,
+ CAM_TARGET_WILDCARD,
+ CAM_LUN_WILDCARD) != CAM_REQ_CMP)
return;
cdm.ccb_h.func_code = XPT_DEV_MATCH;
@@ -913,8 +914,11 @@
cdm.match_buf_len = sizeof(match_result);
cdm.matches = &match_result;
+ sim = xpt_path_sim(cdm.ccb_h.path);
+ CAM_SIM_LOCK(sim);
xpt_action((union ccb *)&cdm);
xpt_free_path(cdm.ccb_h.path);
+ CAM_SIM_UNLOCK(sim);
if ((cdm.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP
|| (cdm.status != CAM_DEV_MATCH_LAST
More information about the Midnightbsd-cvs
mailing list