[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] blkback: Request-processing loop is unbounded and hence requires a



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1200675145 0
# Node ID 77f831cbb91ddca3a7539fa9197d4abc2d2bfcf9
# Parent  4b09218e65b801e937664d2a3363ba0071e0ee66
blkback: Request-processing loop is unbounded and hence requires a
yield point. Also, bad request type is a good cause to sleep for a
short while as the frontend has probably gone mad.

Patch by Steven Smith <steven.smith@xxxxxxxxxxxxx>

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 drivers/xen/blkback/blkback.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)

diff -r 4b09218e65b8 -r 77f831cbb91d drivers/xen/blkback/blkback.c
--- a/drivers/xen/blkback/blkback.c     Fri Jan 18 16:36:01 2008 +0000
+++ b/drivers/xen/blkback/blkback.c     Fri Jan 18 16:52:25 2008 +0000
@@ -38,6 +38,7 @@
 #include <linux/spinlock.h>
 #include <linux/kthread.h>
 #include <linux/list.h>
+#include <linux/delay.h>
 #include <xen/balloon.h>
 #include <asm/hypervisor.h>
 #include "common.h"
@@ -351,6 +352,9 @@ static int do_block_io_op(blkif_t *blkif
                        dispatch_rw_block_io(blkif, &req, pending_req);
                        break;
                default:
+                       /* A good sign something is wrong: sleep for a while to
+                        * avoid excessive CPU consumption by a bad guest. */
+                       mdelay(1);
                        DPRINTK("error: unknown block io operation [%d]\n",
                                req.operation);
                        make_response(blkif, req.id, req.operation,
@@ -358,7 +362,11 @@ static int do_block_io_op(blkif_t *blkif
                        free_req(pending_req);
                        break;
                }
-       }
+
+               /* Yield point for this unbounded loop. */
+               cond_resched();
+       }
+
        return more_to_do;
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.