Patchwork e1000e: fix stats locking in e1000_watchdog_task

login
register
mail settings
Submitter Flavio Leitner
Date April 1, 2011, 6:16 p.m.
Message ID <1301681764-25315-1-git-send-email-fleitner@redhat.com>
Download mbox | patch
Permalink /patch/89316/
State Awaiting Upstream
Delegated to: David Miller
Headers show

Comments

Flavio Leitner - April 1, 2011, 6:16 p.m.
Just move the unlock down a bit because it unlocks too
early leaving a chance for get_stats64() run in parallel
while it is still accessing the stats.

Signed-off-by: Flavio Leitner <fleitner@redhat.com>
---
 drivers/net/e1000e/netdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Jeff Kirsher - April 4, 2011, 8:32 a.m.
On Fri, Apr 1, 2011 at 11:16, Flavio Leitner <fleitner@redhat.com> wrote:
> Just move the unlock down a bit because it unlocks too
> early leaving a chance for get_stats64() run in parallel
> while it is still accessing the stats.
>
> Signed-off-by: Flavio Leitner <fleitner@redhat.com>
> ---
>  drivers/net/e1000e/netdev.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>

Thanks!  I have added this to my e1000e queue of patches.

Patch

diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index a39d4a4..c19e4f0 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -4328,7 +4328,6 @@  static void e1000_watchdog_task(struct work_struct *work)
 link_up:
 	spin_lock(&adapter->stats64_lock);
 	e1000e_update_stats(adapter);
-	spin_unlock(&adapter->stats64_lock);
 
 	mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old;
 	adapter->tpt_old = adapter->stats.tpt;
@@ -4339,6 +4338,7 @@  link_up:
 	adapter->gorc_old = adapter->stats.gorc;
 	adapter->gotc = adapter->stats.gotc - adapter->gotc_old;
 	adapter->gotc_old = adapter->stats.gotc;
+	spin_unlock(&adapter->stats64_lock);
 
 	e1000e_update_adaptive(&adapter->hw);