aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-07-02 12:32:55 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-03 01:27:25 -0400
commit1788f49548860fa1c861ee3454d47b466c877e43 (patch)
treefa1b0633814188f942441eaa5a89dd504faae819 /drivers/net
parent4a49043223e5047c8f60a09f7b2927a2e6e8dfc7 (diff)
virtio_net: do not reschedule rx refill forever
We currently fill all of RX ring, then add_buf returns ENOSPC, which gets mis-detected as an out of memory condition and causes us to reschedule the work, and so on forever. Fix this by oom = err == -ENOMEM; Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: stable@kernel.org # .34.x Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/virtio_net.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 1edb7a61983c..ee7571195b10 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -415,7 +415,7 @@ static int add_recvbuf_mergeable(struct virtnet_info *vi, gfp_t gfp)
415static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp) 415static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp)
416{ 416{
417 int err; 417 int err;
418 bool oom = false; 418 bool oom;
419 419
420 do { 420 do {
421 if (vi->mergeable_rx_bufs) 421 if (vi->mergeable_rx_bufs)
@@ -425,10 +425,9 @@ static bool try_fill_recv(struct virtnet_info *vi, gfp_t gfp)
425 else 425 else
426 err = add_recvbuf_small(vi, gfp); 426 err = add_recvbuf_small(vi, gfp);
427 427
428 if (err < 0) { 428 oom = err == -ENOMEM;
429 oom = true; 429 if (err < 0)
430 break; 430 break;
431 }
432 ++vi->num; 431 ++vi->num;
433 } while (err > 0); 432 } while (err > 0);
434 if (unlikely(vi->num > vi->max)) 433 if (unlikely(vi->num > vi->max))