aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/xen/blkfront/blkfront.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/xen/blkfront/blkfront.c')
-rw-r--r--sys/dev/xen/blkfront/blkfront.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/xen/blkfront/blkfront.c b/sys/dev/xen/blkfront/blkfront.c
index 2477d783d5fc..26f935199b99 100644
--- a/sys/dev/xen/blkfront/blkfront.c
+++ b/sys/dev/xen/blkfront/blkfront.c
@@ -602,8 +602,8 @@ xbd_dump(void *arg, void *virtual, vm_offset_t physical, off_t offset,
int sbp;
int rc = 0;
- if (length <= 0)
- return (rc);
+ if (length == 0)
+ return (0);
xbd_quiesce(sc); /* All quiet on the western front. */
@@ -1333,7 +1333,10 @@ xbd_connect(struct xbd_softc *sc)
if (sc->xbd_max_request_indirectpages > 0) {
indirectpages = contigmalloc(
PAGE_SIZE * sc->xbd_max_request_indirectpages,
- M_XENBLOCKFRONT, M_ZERO, 0, ~0, PAGE_SIZE, 0);
+ M_XENBLOCKFRONT, M_ZERO | M_NOWAIT, 0, ~0,
+ PAGE_SIZE, 0);
+ if (indirectpages == NULL)
+ sc->xbd_max_request_indirectpages = 0;
} else {
indirectpages = NULL;
}
@@ -1345,8 +1348,12 @@ xbd_connect(struct xbd_softc *sc)
&cm->cm_indirectionrefs[j]))
break;
}
- if (j < sc->xbd_max_request_indirectpages)
+ if (j < sc->xbd_max_request_indirectpages) {
+ contigfree(indirectpages,
+ PAGE_SIZE * sc->xbd_max_request_indirectpages,
+ M_XENBLOCKFRONT);
break;
+ }
cm->cm_indirectionpages = indirectpages;
xbd_free_command(cm);
}