Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: don't merge bios with different app_tags

nvme_set_app_tag() uses the app_tag value from the bio_integrity_payload
of the struct request's first bio. This assumes all the request's bios
have the same app_tag. However, it is possible for bios with different
app_tag values to be merged into a single request.
Add a check in blk_integrity_merge_{bio,rq}() to prevent the merging of
bios/requests with different app_tag values if BIP_CHECK_APPTAG is set.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Fixes: 3d8b5a22d404 ("block: add support to pass user meta buffer")
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Caleb Sander Mateos and committed by
Jens Axboe
6acd4ac5 7d121d70

+18 -5
+18 -5
block/blk-integrity.c
··· 140 140 bool blk_integrity_merge_rq(struct request_queue *q, struct request *req, 141 141 struct request *next) 142 142 { 143 + struct bio_integrity_payload *bip, *bip_next; 144 + 143 145 if (blk_integrity_rq(req) == 0 && blk_integrity_rq(next) == 0) 144 146 return true; 145 147 146 148 if (blk_integrity_rq(req) == 0 || blk_integrity_rq(next) == 0) 147 149 return false; 148 150 149 - if (bio_integrity(req->bio)->bip_flags != 150 - bio_integrity(next->bio)->bip_flags) 151 + bip = bio_integrity(req->bio); 152 + bip_next = bio_integrity(next->bio); 153 + if (bip->bip_flags != bip_next->bip_flags) 154 + return false; 155 + 156 + if (bip->bip_flags & BIP_CHECK_APPTAG && 157 + bip->app_tag != bip_next->app_tag) 151 158 return false; 152 159 153 160 if (req->nr_integrity_segments + next->nr_integrity_segments > ··· 170 163 bool blk_integrity_merge_bio(struct request_queue *q, struct request *req, 171 164 struct bio *bio) 172 165 { 166 + struct bio_integrity_payload *bip, *bip_bio = bio_integrity(bio); 173 167 int nr_integrity_segs; 174 168 175 - if (blk_integrity_rq(req) == 0 && bio_integrity(bio) == NULL) 169 + if (blk_integrity_rq(req) == 0 && bip_bio == NULL) 176 170 return true; 177 171 178 - if (blk_integrity_rq(req) == 0 || bio_integrity(bio) == NULL) 172 + if (blk_integrity_rq(req) == 0 || bip_bio == NULL) 179 173 return false; 180 174 181 - if (bio_integrity(req->bio)->bip_flags != bio_integrity(bio)->bip_flags) 175 + bip = bio_integrity(req->bio); 176 + if (bip->bip_flags != bip_bio->bip_flags) 177 + return false; 178 + 179 + if (bip->bip_flags & BIP_CHECK_APPTAG && 180 + bip->app_tag != bip_bio->app_tag) 182 181 return false; 183 182 184 183 nr_integrity_segs = blk_rq_count_integrity_sg(q, bio);