[PATCH v2 06/14] block: blk-merge: fix merging two requests in ll_merge_requests_fn

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



blk_integrity_merge_rq() merges integrity segment information of two
requests. However, it is only a condition check and does not perform the
actual integrity information update. So this was modified.

After it is called, the merge process of the requests may fail
due to other conditions. At this time, there is an error in the integrity
segment information of request. So the call location was also changed.

Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Martin K. Petersen <martin.petersen@xxxxxxxxxx>

Fixes: 13f05c8d8e98 ("block/scsi: Provide a limit on the number of integrity segments")
Signed-off-by: Jinyoung Choi <j-young.choi@xxxxxxxxxxx>
---
 block/blk-integrity.c | 2 ++
 block/blk-merge.c     | 5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index 03a85e1f6d2e..f97b7e8a6d4d 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -181,6 +181,8 @@ bool blk_integrity_merge_rq(struct request_queue *q, struct request *req,
 	if (integrity_req_gap_back_merge(req, next->bio))
 		return false;
 
+	req->nr_integrity_segments += next->nr_integrity_segments;
+
 	return true;
 }
 
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 8509f468d6d4..c6a0958e8df1 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -711,10 +711,11 @@ static int ll_merge_requests_fn(struct request_queue *q, struct request *req,
 	if (!blk_cgroup_mergeable(req, next->bio))
 		return 0;
 
-	if (blk_integrity_merge_rq(q, req, next) == false)
+	if (!bio_crypt_ctx_merge_rq(req, next))
 		return 0;
 
-	if (!bio_crypt_ctx_merge_rq(req, next))
+	/* this will merge integrity segments */
+	if (!blk_integrity_merge_rq(q, req, next))
 		return 0;
 
 	/* Merge is OK... */
-- 
2.34.1



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux