Date: Fri, 19 Dec 2008 14:31:40 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r186319 - in head/sys/cam: . scsi Message-ID: <200812191431.mBJEVeJ6074239@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Fri Dec 19 14:31:40 2008 New Revision: 186319 URL: http://svn.freebsd.org/changeset/base/186319 Log: Periph driver fixes, second try. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: head/sys/cam/cam_periph.c head/sys/cam/cam_periph.h head/sys/cam/cam_xpt.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Fri Dec 19 14:27:10 2008 (r186318) +++ head/sys/cam/cam_periph.c Fri Dec 19 14:31:40 2008 (r186319) @@ -290,7 +290,7 @@ cam_periph_acquire(struct cam_periph *pe } void -cam_periph_release(struct cam_periph *periph) +cam_periph_release_locked(struct cam_periph *periph) { if (periph == NULL) @@ -302,7 +302,21 @@ cam_periph_release(struct cam_periph *pe camperiphfree(periph); } xpt_unlock_buses(); +} + +void +cam_periph_release(struct cam_periph *periph) +{ + struct cam_sim *sim; + if (periph == NULL) + return; + + sim = periph->sim; + mtx_assert(sim->mtx, MA_NOTOWNED); + mtx_lock(sim->mtx); + cam_periph_release_locked(periph); + mtx_unlock(sim->mtx); } int @@ -329,7 +343,7 @@ cam_periph_hold(struct cam_periph *perip while ((periph->flags & CAM_PERIPH_LOCKED) != 0) { periph->flags |= CAM_PERIPH_LOCK_WANTED; if ((error = msleep(periph, mtx, priority, "caplck", 0)) != 0) { - cam_periph_release(periph); + cam_periph_release_locked(periph); return (error); } } @@ -350,7 +364,7 @@ cam_periph_unhold(struct cam_periph *per wakeup(periph); } - cam_periph_release(periph); + cam_periph_release_locked(periph); } /* Modified: head/sys/cam/cam_periph.h ============================================================================== --- head/sys/cam/cam_periph.h Fri Dec 19 14:27:10 2008 (r186318) +++ head/sys/cam/cam_periph.h Fri Dec 19 14:31:40 2008 (r186319) @@ -141,6 +141,7 @@ cam_status cam_periph_alloc(periph_ctor_ struct cam_periph *cam_periph_find(struct cam_path *path, char *name); cam_status cam_periph_acquire(struct cam_periph *periph); void cam_periph_release(struct cam_periph *periph); +void cam_periph_release_locked(struct cam_periph *periph); int cam_periph_hold(struct cam_periph *periph, int priority); void cam_periph_unhold(struct cam_periph *periph); void cam_periph_invalidate(struct cam_periph *periph); Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Fri Dec 19 14:27:10 2008 (r186318) +++ head/sys/cam/cam_xpt.c Fri Dec 19 14:31:40 2008 (r186319) @@ -6314,7 +6314,7 @@ probedone(struct cam_periph *periph, uni xpt_done(done_ccb); if (TAILQ_FIRST(&softc->request_ccbs) == NULL) { cam_periph_invalidate(periph); - cam_periph_release(periph); + cam_periph_release_locked(periph); } else { probeschedule(periph); } Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Fri Dec 19 14:27:10 2008 (r186318) +++ head/sys/cam/scsi/scsi_da.c Fri Dec 19 14:31:40 2008 (r186319) @@ -772,8 +772,8 @@ daclose(struct disk *dp) softc->flags &= ~DA_FLAG_OPEN; cam_periph_unhold(periph); - cam_periph_release(periph); cam_periph_unlock(periph); + cam_periph_release(periph); return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812191431.mBJEVeJ6074239>