bio-integrity: bio_trim should truncate integrity vector accordingly
authorDmitry Monakhov <dmonakhov@openvz.org>
Thu, 29 Jun 2017 18:31:08 +0000 (11:31 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 3 Jul 2017 22:56:19 +0000 (16:56 -0600)
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio.c

index 1cfcd0df3f30f7635d2ca5ac27e356196d56646f..5b4b32a2f8d0e36f3ef3168dd2c41b52770f29e5 100644 (file)
@@ -1900,6 +1900,10 @@ void bio_trim(struct bio *bio, int offset, int size)
        bio_advance(bio, offset << 9);
 
        bio->bi_iter.bi_size = size;
+
+       if (bio_integrity(bio))
+               bio_integrity_trim(bio, 0, size);
+
 }
 EXPORT_SYMBOL_GPL(bio_trim);