summaryrefslogtreecommitdiffstats
path: root/sys/dev/ciss/ciss.c
diff options
context:
space:
mode:
authorsbruno <sbruno@FreeBSD.org>2014-04-11 20:19:01 +0000
committersbruno <sbruno@FreeBSD.org>2014-04-11 20:19:01 +0000
commitd85167d0d7efd74e7c6db42b525eeba00a7fe1f4 (patch)
tree60ba629ff57301c3dd5feac8d93f28c504916c1b /sys/dev/ciss/ciss.c
parent335d93f16dca11130ef6abd26eee1c6f9f29a97e (diff)
downloadFreeBSD-src-d85167d0d7efd74e7c6db42b525eeba00a7fe1f4.zip
FreeBSD-src-d85167d0d7efd74e7c6db42b525eeba00a7fe1f4.tar.gz
Fix insta-panic on assert of unlocked periph mtx in ciss(4) when
logical volume state changes. Currently, I view this as a critical fix for users and will MFC this rapidly as my testing has shown data loss when the disk is failed by removing it when under some amount of write activity and this code panics the box. Reviewed by: mav@ scottl@ MFC after: 3 days Sponsored by: Yahoo! Inc.
Diffstat (limited to 'sys/dev/ciss/ciss.c')
-rw-r--r--sys/dev/ciss/ciss.c35
1 files changed, 11 insertions, 24 deletions
diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c
index bb84726..c8dee70 100644
--- a/sys/dev/ciss/ciss.c
+++ b/sys/dev/ciss/ciss.c
@@ -180,8 +180,6 @@ static int ciss_cam_emulate(struct ciss_softc *sc, struct ccb_scsiio *csio);
static void ciss_cam_poll(struct cam_sim *sim);
static void ciss_cam_complete(struct ciss_request *cr);
static void ciss_cam_complete_fixup(struct ciss_softc *sc, struct ccb_scsiio *csio);
-static struct cam_periph *ciss_find_periph(struct ciss_softc *sc,
- int bus, int target);
static int ciss_name_device(struct ciss_softc *sc, int bus, int target);
/* periodic status monitoring */
@@ -3413,27 +3411,6 @@ ciss_cam_complete_fixup(struct ciss_softc *sc, struct ccb_scsiio *csio)
/********************************************************************************
- * Find a peripheral attached at (target)
- */
-static struct cam_periph *
-ciss_find_periph(struct ciss_softc *sc, int bus, int target)
-{
- struct cam_periph *periph;
- struct cam_path *path;
- int status;
-
- status = xpt_create_path(&path, NULL, cam_sim_path(sc->ciss_cam_sim[bus]),
- target, 0);
- if (status == CAM_REQ_CMP) {
- periph = cam_periph_find(path, NULL);
- xpt_free_path(path);
- } else {
- periph = NULL;
- }
- return(periph);
-}
-
-/********************************************************************************
* Name the device at (target)
*
* XXX is this strictly correct?
@@ -3442,12 +3419,22 @@ static int
ciss_name_device(struct ciss_softc *sc, int bus, int target)
{
struct cam_periph *periph;
+ struct cam_path *path;
+ int status;
if (CISS_IS_PHYSICAL(bus))
return (0);
- if ((periph = ciss_find_periph(sc, bus, target)) != NULL) {
+
+ status = xpt_create_path(&path, NULL, cam_sim_path(sc->ciss_cam_sim[bus]),
+ target, 0);
+
+ if (status == CAM_REQ_CMP) {
+ xpt_path_lock(path);
+ periph = cam_periph_find(path, NULL);
sprintf(sc->ciss_logical[bus][target].cl_name, "%s%d",
periph->periph_name, periph->unit_number);
+ xpt_path_unlock(path);
+ xpt_free_path(path);
return(0);
}
sc->ciss_logical[bus][target].cl_name[0] = 0;
OpenPOWER on IntegriCloud