be2net: Fix race in posting rx buffers.
authorSathya Perla <sathya.perla@emulex.com>
Mon, 22 Aug 2011 19:41:51 +0000 (19:41 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Aug 2011 23:19:28 +0000 (16:19 -0700)
There is a possibility of be_post_rx_frags() being called simultaneously from
both be_worker() (when rx_post_starved) and be_poll_rx() (when rxq->used is 0).
This can be avoided by posting rx buffers only when some completions have been
reaped.

Signed-off-by: Sathya Perla <sathya.perla@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/emulex/benet/be_main.c

index ef62594a19cdd5cf837c60ca4aa533af6c324667..09eb6998e4d806e9cd59580c6b5dbbbb3708e313 100644 (file)
@@ -1862,7 +1862,7 @@ loop_continue:
        }
 
        /* Refill the queue */
-       if (atomic_read(&rxo->q.used) < RX_FRAGS_REFILL_WM)
+       if (work_done && atomic_read(&rxo->q.used) < RX_FRAGS_REFILL_WM)
                be_post_rx_frags(rxo, GFP_ATOMIC);
 
        /* All consumed */