[PATCH 5.1 279/405] block: avoid to break XEN by multi-page bvec

From: Greg Kroah-Hartman
Date: Thu May 30 2019 - 00:33:30 EST


[ Upstream commit db5ebd6edd2627d7e81a031643cf43587f63e66c ]

XEN has special page merge requirement, see xen_biovec_phys_mergeable().
We can't merge pages into one bvec simply for XEN.

So move XEN's specific check on page merge into __bio_try_merge_page(),
then abvoid to break XEN by multi-page bvec.

Cc: ris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
Cc: Omar Sandoval <osandov@xxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
block/bio.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/block/bio.c b/block/bio.c
index 716510ecd7ffa..a3c80a6c1fe51 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -776,6 +776,8 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page,

if (vec_end_addr + 1 != page_addr + off)
return false;
+ if (xen_domain() && !xen_biovec_phys_mergeable(bv, page))
+ return false;
if (same_page && (vec_end_addr & PAGE_MASK) != page_addr)
return false;

--
2.20.1