From owner-svn-src-head@FreeBSD.ORG Sat Feb 18 09:18:07 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90BF4106566C; Sat, 18 Feb 2012 09:18:07 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 806368FC15; Sat, 18 Feb 2012 09:18:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1I9I7HZ021004; Sat, 18 Feb 2012 09:18:07 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1I9I7eZ021002; Sat, 18 Feb 2012 09:18:07 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201202180918.q1I9I7eZ021002@svn.freebsd.org> From: Adrian Chadd Date: Sat, 18 Feb 2012 09:18:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231893 - head/sys/dev/ath X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Feb 2012 09:18:07 -0000 Author: adrian Date: Sat Feb 18 09:18:06 2012 New Revision: 231893 URL: http://svn.freebsd.org/changeset/base/231893 Log: Try to ensure that ieee80211_newstate() and the vap_newstate methods hold the lock. This is part of my series of work to try and capture when net80211 locking isn't. ObNote: it'd be nice to be able to mark a lock as "assert if the lock is dropped", so I could capture functions which decide that dropping and reacquiring the lock is a good idea (without re-checking the sanity of the state protected by the lock.) Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Sat Feb 18 00:57:11 2012 (r231892) +++ head/sys/dev/ath/if_ath.c Sat Feb 18 09:18:06 2012 (r231893) @@ -5711,6 +5711,15 @@ ath_newstate(struct ieee80211vap *vap, e ieee80211_state_name[vap->iv_state], ieee80211_state_name[nstate]); + /* + * net80211 _should_ have the comlock asserted at this point. + * There are some comments around the calls to vap->iv_newstate + * which indicate that it (newstate) may end up dropping the + * lock. This and the subsequent lock assert check after newstate + * are an attempt to catch these and figure out how/why. + */ + IEEE80211_LOCK_ASSERT(ic); + if (vap->iv_state == IEEE80211_S_CSA && nstate == IEEE80211_S_RUN) csa_run_transition = 1; @@ -5760,6 +5769,12 @@ ath_newstate(struct ieee80211vap *vap, e if (error != 0) goto bad; + /* + * See above: ensure av_newstate() doesn't drop the lock + * on us. + */ + IEEE80211_LOCK_ASSERT(ic); + if (nstate == IEEE80211_S_RUN) { /* NB: collect bss node again, it may have changed */ ieee80211_free_node(ni);