PERFORCE change 116625 for review
Scott Long
scottl at FreeBSD.org
Tue Mar 27 05:01:20 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=116625
Change 116625 by scottl at scottl-x64 on 2007/03/27 05:01:18
Fix up refcounting in the pass driver.
Affected files ...
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_pass.c#19 edit
Differences ...
==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_pass.c#19 (text+ko) ====
@@ -331,7 +331,7 @@
error = 0; /* default to no error */
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
+ if (cam_periph_acquire(periph) != CAM_REQ_CMP)
return (ENXIO);
cam_periph_lock(periph);
@@ -342,6 +342,7 @@
if (softc->flags & PASS_FLAG_INVALID) {
splx(s);
cam_periph_unlock(periph);
+ cam_periph_release(periph);
return(ENXIO);
}
@@ -352,6 +353,7 @@
if (error) {
splx(s);
cam_periph_unlock(periph);
+ cam_periph_release(periph);
return(error);
}
@@ -361,6 +363,7 @@
if (((flags & FWRITE) == 0) || ((flags & FREAD) == 0)) {
splx(s);
cam_periph_unlock(periph);
+ cam_periph_release(periph);
return(EPERM);
}
@@ -371,17 +374,17 @@
xpt_print(periph->path, "can't do nonblocking access\n");
splx(s);
cam_periph_unlock(periph);
+ cam_periph_release(periph);
return(EINVAL);
}
splx(s);
if ((softc->flags & PASS_FLAG_OPEN) == 0) {
- if (cam_periph_acquire(periph) != CAM_REQ_CMP) {
- cam_periph_unlock(periph);
- return(ENXIO);
- }
softc->flags |= PASS_FLAG_OPEN;
+ } else {
+ /* Device closes aren't symmertical, so fix up the refcount */
+ cam_periph_release(periph);
}
cam_periph_unlock(periph);
@@ -404,8 +407,8 @@
softc = (struct pass_softc *)periph->softc;
softc->flags &= ~PASS_FLAG_OPEN;
+ cam_periph_unlock(periph);
cam_periph_release(periph);
- cam_periph_unlock(periph);
return (0);
}
@@ -526,7 +529,7 @@
break;
}
- cam_periph_lock(periph);
+ cam_periph_unlock(periph);
return(error);
}
More information about the p4-projects
mailing list