When a Reset WP is requested from a partition offset the blk_partition_remap
should be applied.

Signed-off-by: Shaun Tancheff <[email protected]>
---
Based on for-4.10/block
---
 block/blk-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 473dd69..3f85320 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1786,8 +1786,9 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, 
struct bio *bio)
 static inline void blk_partition_remap(struct bio *bio)
 {
        struct block_device *bdev = bio->bi_bdev;
+       bool remap = bio_sectors(bio) != 0 || bio_op(bio) == REQ_OP_ZONE_RESET;
 
-       if (bio_sectors(bio) && bdev != bdev->bd_contains) {
+       if (remap && bdev != bdev->bd_contains) {
                struct hd_struct *p = bdev->bd_part;
 
                bio->bi_iter.bi_sector += p->start_sect;
-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to