rp = blk_rings->common.sring->req_prod;
rmb(); /* Ensure we see queued requests up to 'rp'. */
- while ((rc != rp)) {
+ while (rc != rp) {
if (RING_REQUEST_CONS_OVERFLOW(&blk_rings->common, rc))
break;
break;
}
+ if (kthread_should_stop()) {
+ more_to_do = 1;
+ break;
+ }
+
switch (blkif->blk_protocol) {
case BLKIF_PROTOCOL_NATIVE:
memcpy(&req, RING_GET_REQUEST(&blk_rings->native, rc), sizeof(req));
default:
/* A good sign something is wrong: sleep for a while to
* avoid excessive CPU consumption by a bad guest. */
- mdelay(1);
+ msleep(1);
DPRINTK("error: unknown block io operation [%d]\n",
req.operation);
make_response(blkif, req.id, req.operation,
fail_response:
make_response(blkif, req->id, req->operation, BLKIF_RSP_ERROR);
free_req(pending_req);
+ msleep(1); /* back off a bit */
}
#include <linux/major.h>
#include <linux/gfp.h>
#include <linux/poll.h>
+#include <linux/delay.h>
#include <asm/tlbflush.h>
#define MAX_TAP_DEV 256 /*the maximum number of tapdisk ring devices */
break;
}
+ if (kthread_should_stop()) {
+ more_to_do = 1;
+ break;
+ }
+
switch (blkif->blk_protocol) {
case BLKIF_PROTOCOL_NATIVE:
memcpy(&req, RING_GET_REQUEST(&blk_rings->native, rc),
break;
default:
+ /* A good sign something is wrong: sleep for a while to
+ * avoid excessive CPU consumption by a bad guest. */
+ msleep(1);
WPRINTK("unknown operation [%d]\n",
req.operation);
make_response(blkif, req.id, req.operation,
free_req(pending_req);
break;
}
+
+ /* Yield point for this unbounded loop. */
+ cond_resched();
}
blktap_kick_user(blkif->dev_num);
fail_response:
make_response(blkif, req->id, req->operation, BLKIF_RSP_ERROR);
free_req(pending_req);
-}
+ msleep(1); /* back off a bit */
+}