Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174061591
D31726.id94919.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D31726.id94919.diff
View Options
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -371,6 +371,7 @@
{
struct cd_softc *softc;
+ cam_periph_assert(periph, MA_OWNED);
softc = (struct cd_softc *)periph->softc;
/*
@@ -451,7 +452,7 @@
printf("cdasync: Unable to attach new device "
"due to status 0x%x\n", status);
- break;
+ return;
}
case AC_UNIT_ATTENTION:
{
@@ -471,10 +472,10 @@
if (asc == 0x28 && ascq == 0x00)
disk_media_changed(softc->disk, M_NOWAIT);
}
- cam_periph_async(periph, code, path, arg);
break;
}
case AC_SCSI_AEN:
+ cam_periph_assert(periph, MA_OWNED);
softc = (struct cd_softc *)periph->softc;
if (softc->state == CD_STATE_NORMAL && !softc->tur) {
if (cam_periph_acquire(periph) == 0) {
@@ -488,6 +489,7 @@
{
struct ccb_hdr *ccbh;
+ cam_periph_assert(periph, MA_OWNED);
softc = (struct cd_softc *)periph->softc;
/*
* Don't fail on the expected unit attention
@@ -496,12 +498,13 @@
softc->flags |= CD_FLAG_RETRY_UA;
LIST_FOREACH(ccbh, &softc->pending_ccbs, periph_links.le)
ccbh->ccb_state |= CD_CCB_RETRY_UA;
- /* FALLTHROUGH */
+ break;
}
default:
- cam_periph_async(periph, code, path, arg);
break;
}
+
+ cam_periph_async(periph, code, path, arg);
}
static void
@@ -520,7 +523,9 @@
snprintf(tmpstr2, sizeof(tmpstr2), "%d", periph->unit_number);
sysctl_ctx_init(&softc->sysctl_ctx);
+ cam_periph_lock(periph);
softc->flags |= CD_FLAG_SCTX_INIT;
+ cam_periph_unlock(periph);
softc->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&softc->sysctl_ctx,
SYSCTL_STATIC_CHILDREN(_kern_cam_cd), OID_AUTO,
tmpstr2, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, tmpstr,
@@ -899,6 +904,7 @@
struct bio *bp;
struct ccb_scsiio *csio;
+ cam_periph_assert(periph, MA_OWNED);
softc = (struct cd_softc *)periph->softc;
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdstart\n"));
@@ -1143,6 +1149,7 @@
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cddone\n"));
+ cam_periph_assert(periph, MA_OWNED);
softc = (struct cd_softc *)periph->softc;
csio = &done_ccb->csio;
@@ -2624,6 +2631,7 @@
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdprevent\n"));
+ cam_periph_assert(periph, MA_OWNED);
softc = (struct cd_softc *)periph->softc;
if (((action == PR_ALLOW)
@@ -2661,6 +2669,7 @@
{
struct cd_softc *softc;
+ cam_periph_assert(periph, MA_OWNED);
softc = (struct cd_softc *)periph->softc;
softc->flags &= ~CD_FLAG_MEDIA_SCAN_ACT;
@@ -2682,6 +2691,7 @@
struct cd_softc *softc;
int error;
+ cam_periph_assert(periph, MA_OWNED);
softc = (struct cd_softc *)periph->softc;
error = 0;
@@ -3071,6 +3081,8 @@
periph = xpt_path_periph(ccb->ccb_h.path);
softc = (struct cd_softc *)periph->softc;
+ cam_periph_assert(periph, MA_OWNED);
+
error = 0;
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 1, 7:42 AM (8 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40004781
Default Alt Text
D31726.id94919.diff (2 KB)
Attached To
Mode
D31726: Fix data race in scsi cd driver
Attached
Detach File
Event Timeline
Log In to Comment