]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Change improper locking assertion in mge
authorzbb <zbb@FreeBSD.org>
Sun, 25 Oct 2015 22:17:10 +0000 (22:17 +0000)
committerzbb <zbb@FreeBSD.org>
Sun, 25 Oct 2015 22:17:10 +0000 (22:17 +0000)
Assertion used here was invalid. If current thread helds any of locks,
we never want to recurse on them.

Obtained from:  Semihalf
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision: https://reviews.freebsd.org/D3903

sys/dev/mge/if_mgevar.h

index 1888efba99844b0c54c71fb27babe1548896f497..31b9ac379a14d9bbad4477c4c655e7e202a7af46 100644 (file)
@@ -137,10 +137,8 @@ struct mge_softc {
 #define MGE_RECEIVE_LOCK_ASSERT(sc)    mtx_assert(&(sc)->receive_lock, MA_OWNED)
 
 #define MGE_GLOBAL_LOCK(sc) do {                                               \
-                       if ((mtx_owned(&(sc)->transmit_lock) ? 1 : 0) !=        \
-                           (mtx_owned(&(sc)->receive_lock) ? 1 : 0)) {         \
-                               panic("mge deadlock possibility detection!");   \
-                       }                                                       \
+                       mtx_assert(&(sc)->transmit_lock, MA_NOTOWNED);          \
+                       mtx_assert(&(sc)->receive_lock, MA_NOTOWNED);           \
                        mtx_lock(&(sc)->transmit_lock);                         \
                        mtx_lock(&(sc)->receive_lock);                          \
 } while (0)