aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/xen-blkback/blkback.c1
-rw-r--r--drivers/block/xen-blkback/xenbus.c6
-rw-r--r--drivers/block/xen-blkfront.c12
3 files changed, 13 insertions, 6 deletions
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 64c60edcdfbc..63fc7f06a014 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -763,6 +763,7 @@ again:
763 BUG_ON(new_map_idx >= segs_to_map); 763 BUG_ON(new_map_idx >= segs_to_map);
764 if (unlikely(map[new_map_idx].status != 0)) { 764 if (unlikely(map[new_map_idx].status != 0)) {
765 pr_debug(DRV_PFX "invalid buffer -- could not remap it\n"); 765 pr_debug(DRV_PFX "invalid buffer -- could not remap it\n");
766 put_free_pages(blkif, &pages[seg_idx]->page, 1);
766 pages[seg_idx]->handle = BLKBACK_INVALID_HANDLE; 767 pages[seg_idx]->handle = BLKBACK_INVALID_HANDLE;
767 ret |= 1; 768 ret |= 1;
768 goto next; 769 goto next;
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 3a8b810b4980..54f408963201 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -270,6 +270,9 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
270 blkif->blk_rings.common.sring = NULL; 270 blkif->blk_rings.common.sring = NULL;
271 } 271 }
272 272
273 /* Remove all persistent grants and the cache of ballooned pages. */
274 xen_blkbk_free_caches(blkif);
275
273 return 0; 276 return 0;
274} 277}
275 278
@@ -281,9 +284,6 @@ static void xen_blkif_free(struct xen_blkif *blkif)
281 xen_blkif_disconnect(blkif); 284 xen_blkif_disconnect(blkif);
282 xen_vbd_free(&blkif->vbd); 285 xen_vbd_free(&blkif->vbd);
283 286
284 /* Remove all persistent grants and the cache of ballooned pages. */
285 xen_blkbk_free_caches(blkif);
286
287 /* Make sure everything is drained before shutting down */ 287 /* Make sure everything is drained before shutting down */
288 BUG_ON(blkif->persistent_gnt_c != 0); 288 BUG_ON(blkif->persistent_gnt_c != 0);
289 BUG_ON(atomic_read(&blkif->persistent_gnt_in_use) != 0); 289 BUG_ON(atomic_read(&blkif->persistent_gnt_in_use) != 0);
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 5deb235bd18f..6fc056ed1efd 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -582,6 +582,14 @@ static inline void flush_requests(struct blkfront_info *info)
582 notify_remote_via_irq(info->irq); 582 notify_remote_via_irq(info->irq);
583} 583}
584 584
585static inline bool blkif_request_flush_valid(struct request *req,
586 struct blkfront_info *info)
587{
588 return ((req->cmd_type != REQ_TYPE_FS) ||
589 ((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
590 !info->flush_op));
591}
592
585/* 593/*
586 * do_blkif_request 594 * do_blkif_request
587 * read a block; request is in a request queue 595 * read a block; request is in a request queue
@@ -604,9 +612,7 @@ static void do_blkif_request(struct request_queue *rq)
604 612
605 blk_start_request(req); 613 blk_start_request(req);
606 614
607 if ((req->cmd_type != REQ_TYPE_FS) || 615 if (blkif_request_flush_valid(req, info)) {
608 ((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
609 !info->flush_op)) {
610 __blk_end_request_all(req, -EIO); 616 __blk_end_request_all(req, -EIO);
611 continue; 617 continue;
612 } 618 }