From: David Vrabel <david.vrabel@citrix.com>
To: <xen-devel@lists.xen.org>
Cc: David Vrabel <david.vrabel@citrix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Ian Campbell <ian.campbell@citrix.com>,
Jan Beulich <jbeulich@suse.com>, Wei Liu <wei.liu@citrix.com>,
<netdev@vger.kernel.org>
Subject: [PATCH 2/2] xen-netback: cancel the credit timer when taking the vif down
Date: Thu, 14 Feb 2013 13:18:58 +0000 [thread overview]
Message-ID: <1360847938-11185-3-git-send-email-david.vrabel@citrix.com> (raw)
In-Reply-To: <1360847938-11185-1-git-send-email-david.vrabel@citrix.com>
From: David Vrabel <david.vrabel@citrix.com>
If the credit timer is left armed after calling
xen_netbk_remove_xenvif(), then it may fire and attempt to schedule
the vif which will then oops as vif->netbk == NULL.
This may happen both in the fatal error path and during normal
disconnection from the front end.
The sequencing during shutdown is critical to ensure that: a)
vif->netbk doesn't become unexpectedly NULL; and b) the net device/vif
is not freed.
1. Mark as unschedulable (netif_carrier_off()).
2. Synchronously cancel the timer.
3. Remove the vif from the schedule list.
4. Remove it from it netback thread group.
5. Wait for vif->refcnt to become 0.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
drivers/net/xen-netback/interface.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index b8c5193..221f426 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -132,6 +132,7 @@ static void xenvif_up(struct xenvif *vif)
static void xenvif_down(struct xenvif *vif)
{
disable_irq(vif->irq);
+ del_timer_sync(&vif->credit_timeout);
xen_netbk_deschedule_xenvif(vif);
xen_netbk_remove_xenvif(vif);
}
@@ -363,8 +364,6 @@ void xenvif_disconnect(struct xenvif *vif)
atomic_dec(&vif->refcnt);
wait_event(vif->waiting_to_free, atomic_read(&vif->refcnt) == 0);
- del_timer_sync(&vif->credit_timeout);
-
if (vif->irq)
unbind_from_irqhandler(vif->irq, vif);
--
1.7.2.5
next prev parent reply other threads:[~2013-02-14 13:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-14 13:18 xen-netback: fix oopes during shutdown and error handling David Vrabel
2013-02-14 13:18 ` [PATCH 1/2] xen-netback: correctly return errors from netbk_count_requests() David Vrabel
2013-02-14 16:39 ` Ian Campbell
2013-02-14 13:18 ` David Vrabel [this message]
2013-02-14 13:53 ` [Xen-devel] [PATCH 2/2] xen-netback: cancel the credit timer when taking the vif down Wei Liu
2013-02-14 13:56 ` David Vrabel
2013-02-14 14:10 ` Wei Liu
2013-02-14 14:15 ` Jan Beulich
2013-02-14 14:21 ` Wei Liu
2013-02-14 16:39 ` Ian Campbell
2013-02-14 16:48 ` [Xen-devel] " Wei Liu
2013-02-14 18:21 ` xen-netback: fix oopes during shutdown and error handling David Miller
2013-02-14 21:57 ` Christopher S. Aker
2013-02-15 8:45 ` [Xen-devel] " Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1360847938-11185-3-git-send-email-david.vrabel@citrix.com \
--to=david.vrabel@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=jbeulich@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=wei.liu@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).