summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorSagi Grimberg <sagig@mellanox.com>2015-09-11 17:03:04 +0200
committerJens Axboe <axboe@fb.com>2015-09-11 17:03:04 +0200
commit7f39add3b08cbbdb99abe50e6d7c342e6800d684 (patch)
treedd495ebf5446f531d88aee04f00857cff243e586 /block
parentblock: Check for gaps on front and back merges (diff)
downloadlinux-7f39add3b08cbbdb99abe50e6d7c342e6800d684.tar.xz
linux-7f39add3b08cbbdb99abe50e6d7c342e6800d684.zip
block: Refuse request/bio merges with gaps in the integrity payload
If a driver sets the block queue virtual boundary mask, it means that it cannot handle gaps so we must not allow those in the integrity payload as well. Signed-off-by: Sagi Grimberg <sagig@mellanox.com> Fixed up by me to have duplicate integrity merge functions, depending on whether block integrity is enabled or not. Fixes a compilations issue with CONFIG_BLK_DEV_INTEGRITY unset. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-integrity.c3
-rw-r--r--block/blk-merge.c6
2 files changed, 9 insertions, 0 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index f548b64be092..75f29cf70188 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -204,6 +204,9 @@ bool blk_integrity_merge_rq(struct request_queue *q, struct request *req,
q->limits.max_integrity_segments)
return false;
+ if (integrity_req_gap_back_merge(req, next->bio))
+ return false;
+
return true;
}
EXPORT_SYMBOL(blk_integrity_merge_rq);
diff --git a/block/blk-merge.c b/block/blk-merge.c
index d9eddbc189f5..574ea7c0468f 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -440,6 +440,9 @@ int ll_back_merge_fn(struct request_queue *q, struct request *req,
{
if (req_gap_back_merge(req, bio))
return 0;
+ if (blk_integrity_rq(req) &&
+ integrity_req_gap_back_merge(req, bio))
+ return 0;
if (blk_rq_sectors(req) + bio_sectors(bio) >
blk_rq_get_max_sectors(req)) {
req->cmd_flags |= REQ_NOMERGE;
@@ -461,6 +464,9 @@ int ll_front_merge_fn(struct request_queue *q, struct request *req,
if (req_gap_front_merge(req, bio))
return 0;
+ if (blk_integrity_rq(req) &&
+ integrity_req_gap_front_merge(req, bio))
+ return 0;
if (blk_rq_sectors(req) + bio_sectors(bio) >
blk_rq_get_max_sectors(req)) {
req->cmd_flags |= REQ_NOMERGE;