From owner-svn-src-stable@FreeBSD.ORG Sat Feb 28 10:33:00 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD1D7106566C; Sat, 28 Feb 2009 10:33:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AC2D8FC08; Sat, 28 Feb 2009 10:33:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1SAX0Ft002815; Sat, 28 Feb 2009 10:33:00 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1SAX0Nx002810; Sat, 28 Feb 2009 10:33:00 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200902281033.n1SAX0Nx002810@svn.freebsd.org> From: Edward Tomasz Napierala Date: Sat, 28 Feb 2009 10:33:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189147 - in stable/7/sys: . cam cam/scsi contrib/pf dev/cxgb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Feb 2009 10:33:01 -0000 Author: trasz Date: Sat Feb 28 10:33:00 2009 New Revision: 189147 URL: http://svn.freebsd.org/changeset/base/189147 Log: MFC r186319: Periph driver fixes, second try. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Modified: stable/7/sys/ (props changed) stable/7/sys/cam/cam_periph.c stable/7/sys/cam/cam_periph.h stable/7/sys/cam/cam_xpt.c stable/7/sys/cam/scsi/scsi_da.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/cam/cam_periph.c ============================================================================== --- stable/7/sys/cam/cam_periph.c Sat Feb 28 10:29:55 2009 (r189146) +++ stable/7/sys/cam/cam_periph.c Sat Feb 28 10:33:00 2009 (r189147) @@ -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: stable/7/sys/cam/cam_periph.h ============================================================================== --- stable/7/sys/cam/cam_periph.h Sat Feb 28 10:29:55 2009 (r189146) +++ stable/7/sys/cam/cam_periph.h Sat Feb 28 10:33:00 2009 (r189147) @@ -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: stable/7/sys/cam/cam_xpt.c ============================================================================== --- stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:29:55 2009 (r189146) +++ stable/7/sys/cam/cam_xpt.c Sat Feb 28 10:33:00 2009 (r189147) @@ -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: stable/7/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/7/sys/cam/scsi/scsi_da.c Sat Feb 28 10:29:55 2009 (r189146) +++ stable/7/sys/cam/scsi/scsi_da.c Sat Feb 28 10:33:00 2009 (r189147) @@ -771,8 +771,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); }