From owner-svn-src-all@freebsd.org Tue Oct 13 23:42:14 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F19A2A13121; Tue, 13 Oct 2015 23:42:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BCEA01EA0; Tue, 13 Oct 2015 23:42:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9DNgDe3015111; Tue, 13 Oct 2015 23:42:13 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9DNgDR4015110; Tue, 13 Oct 2015 23:42:13 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201510132342.t9DNgDR4015110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 13 Oct 2015 23:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289273 - head/sys/dev/ntb/if_ntb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Oct 2015 23:42:15 -0000 Author: cem Date: Tue Oct 13 23:42:13 2015 New Revision: 289273 URL: https://svnweb.freebsd.org/changeset/base/289273 Log: NTB: MFV fca4d518: Fix ntb_transport link down race A WARN_ON is being hit in ntb_qp_link_work due to the NTB transport link being down while the ntb qp link is still active. This is caused by the transport link being brought down prior to the qp link worker thread being terminated. To correct this, shutdown the qp's prior to bringing the transport link down. Also, only call the qp worker thread if it is in interrupt context, otherwise call the function directly. Authored by: Jon Mason Obtained from: Linux (Dual BSD/GPL driver) Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/ntb/if_ntb/if_ntb.c Modified: head/sys/dev/ntb/if_ntb/if_ntb.c ============================================================================== --- head/sys/dev/ntb/if_ntb/if_ntb.c Tue Oct 13 23:41:40 2015 (r289272) +++ head/sys/dev/ntb/if_ntb/if_ntb.c Tue Oct 13 23:42:13 2015 (r289273) @@ -519,7 +519,7 @@ ntb_transport_free(void *transport) struct ntb_softc *ntb = nt->ntb; int i; - nt->transport_link = NTB_LINK_DOWN; + ntb_transport_link_cleanup(nt); callout_drain(&nt->link_work); @@ -1257,16 +1257,16 @@ ntb_transport_link_cleanup(struct ntb_ne { int i; - if (nt->transport_link == NTB_LINK_DOWN) - callout_drain(&nt->link_work); - else - nt->transport_link = NTB_LINK_DOWN; - /* Pass along the info to any clients */ for (i = 0; i < nt->max_qps; i++) if (!test_bit(i, &nt->qp_bitmap)) ntb_qp_link_down(&nt->qps[i]); + if (nt->transport_link == NTB_LINK_DOWN) + callout_drain(&nt->link_work); + else + nt->transport_link = NTB_LINK_DOWN; + /* * The scratchpad registers keep the values if the remote side * goes down, blast them now to give them a sane value the next