PERFORCE change 212127 for review
Brooks Davis
brooks at FreeBSD.org
Fri Jun 1 22:11:36 UTC 2012
http://p4web.freebsd.org/@@212127?ac=10
Change 212127 by brooks at brooks_ecr_current on 2012/06/01 22:10:33
Push the attach routine in the right direction. I think it is at
least no longer a panic(9) implemenation.
Lock around the ERASE ioctl.
Affected files ...
.. //depot/projects/ctsrd/beribsd/src/sys/dev/isf/isf.c#5 edit
.. //depot/projects/ctsrd/beribsd/src/sys/dev/isf/isf.h#5 edit
.. //depot/projects/ctsrd/beribsd/src/sys/dev/isf/isf_nexus.c#4 edit
Differences ...
==== //depot/projects/ctsrd/beribsd/src/sys/dev/isf/isf.c#5 (text+ko) ====
@@ -302,6 +302,7 @@
uint16_t w, status;
off_t off;
+ ISF_LOCK(sc);
for (off = blk_off; off < blk_off + size; off += 2) {
w = bus_read_2(sc->isf_res, off);
if (w == 0xFFFF)
@@ -321,6 +322,7 @@
isf_write_cmd(sc, off, ISF_CMD_RA);
}
+ ISF_UNLOCK(sc);
}
/*
@@ -384,8 +386,12 @@
ISF_LOCK(sc);
do {
bp = bioq_first(&sc->isf_bioq);
- if (bp == NULL)
- ISF_SLEEP(sc);
+ if (bp == NULL) {
+ if (sc->isf_doomed)
+ kproc_exit(0);
+ else
+ ISF_SLEEP(sc, sc);
+ }
} while (bp == NULL);
bioq_remove(&sc->isf_bioq, bp);
@@ -472,6 +478,7 @@
{
struct disk *disk;
+ sc->isf_doomed = 0;
kproc_create(&isf_task, sc, &sc->isf_proc, 0, 0, "isf");
disk = disk_alloc();
@@ -502,6 +509,10 @@
ISF_LOCK_ASSERT(sc);
KASSERT(sc->isf_disk != NULL, ("%s: isf_disk NULL", __func__));
+ sc->isf_doomed = 0;
+ ISF_WAKEUP(sc);
+ ISF_SLEEP(sc, sc->isf_proc);
+
/*
* XXXRW: Is it OK to call disk_destroy() under the mutex, or should
* we be deferring that to the calling context once it is released?
@@ -539,6 +550,7 @@
isf_read_reg(sc, ISF_REG_ID));
return (ENXIO);
}
+ isf_write_cmd(sc, 0, ISF_CMD_RA);
bioq_init(&sc->isf_bioq);
ISF_LOCK_INIT(sc);
@@ -558,10 +570,11 @@
*
* XXXRW: Is the locking here right?
*/
+ ISF_LOCK(sc);
isf_disk_remove(sc);
- ISF_UNLOCK(sc);
bioq_flush(&sc->isf_bioq, NULL, ENXIO);
KASSERT(bioq_first(&sc->isf_bioq) == NULL,
("%s: non-empty bioq", __func__));
+ ISF_UNLOCK(sc);
ISF_LOCK_DESTROY(sc);
}
==== //depot/projects/ctsrd/beribsd/src/sys/dev/isf/isf.h#5 (text+ko) ====
@@ -60,6 +60,7 @@
struct mtx isf_lock;
struct disk *isf_disk;
struct proc *isf_proc;
+ int isf_doomed;
/*
* Fields relating to in-progress and pending I/O, if any.
@@ -73,7 +74,7 @@
#define ISF_LOCK_DESTROY(sc) mtx_destroy(&(sc)->isf_lock)
#define ISF_LOCK_INIT(sc) mtx_init(&(sc)->isf_lock, "isf", NULL, \
MTX_DEF)
-#define ISF_SLEEP(sc) mtx_sleep((sc), &(sc)->isf_lock, PRIBIO, \
+#define ISF_SLEEP(sc, wait) mtx_sleep((wait), &(sc)->isf_lock, PRIBIO, \
"isf", 0)
#define ISF_UNLOCK(sc) mtx_unlock(&(sc)->isf_lock)
#define ISF_WAKEUP(sc) wakeup((sc))
==== //depot/projects/ctsrd/beribsd/src/sys/dev/isf/isf_nexus.c#4 (text+ko) ====
More information about the p4-projects
mailing list