diff options
author | mjacob <mjacob@FreeBSD.org> | 2010-06-02 18:06:32 +0000 |
---|---|---|
committer | mjacob <mjacob@FreeBSD.org> | 2010-06-02 18:06:32 +0000 |
commit | cfb9348b6980d65002d99e13cf49c6a386082d46 (patch) | |
tree | 44f2282d71ccbeb50748e8401f10977f571fb2e6 /sys/cam/cam_xpt.c | |
parent | 6840cdea0c707d950ac0a2eb39fba080bfbaaebf (diff) | |
download | FreeBSD-src-cfb9348b6980d65002d99e13cf49c6a386082d46.zip FreeBSD-src-cfb9348b6980d65002d99e13cf49c6a386082d46.tar.gz |
Protect periph drivers list and rearrange things to minimize the chance of
stepping oneself during probing.
Don't blindly decrement a periph probe count.
Reviewed by: scsi@
Obtained from: Alexander Motin, Atillio Rao, Others
MFC after: 1 month
Diffstat (limited to 'sys/cam/cam_xpt.c')
-rw-r--r-- | sys/cam/cam_xpt.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 2284006..80dee2a 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -2138,6 +2138,7 @@ xptpdperiphtraverse(struct periph_driver **pdrv, retval = 1; + xpt_lock_buses(); for (periph = (start_periph ? start_periph : TAILQ_FIRST(&(*pdrv)->units)); periph != NULL; periph = next_periph) { @@ -2145,9 +2146,12 @@ xptpdperiphtraverse(struct periph_driver **pdrv, next_periph = TAILQ_NEXT(periph, unit_links); retval = tr_func(periph, arg); - if (retval == 0) + if (retval == 0) { + xpt_unlock_buses(); return(retval); + } } + xpt_unlock_buses(); return(retval); } @@ -2323,7 +2327,6 @@ xpt_action_default(union ccb *start_ccb) CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_TRACE, ("xpt_action_default\n")); - switch (start_ccb->ccb_h.func_code) { case XPT_SCSI_IO: { @@ -2670,7 +2673,9 @@ xpt_action_default(union ccb *start_ccb) xptedtmatch(cdm); break; case CAM_DEV_POS_PDRV: + xpt_lock_buses(); xptperiphlistmatch(cdm); + xpt_unlock_buses(); break; default: cdm->status = CAM_DEV_MATCH_ERROR; |