Commit 264c869d authored by Damien Le Moal's avatar Damien Le Moal Committed by Mike Snitzer

dm: fix REQ_OP_ZONE_REPORT bio handling

A REQ_OP_ZONE_REPORT bio is not a medium access command.  Its number of
sectors indicates the maximum size allowed for the report reply size and
not an amount of sectors accessed from the device.  REQ_OP_ZONE_REPORT
bios should thus not be split depending on the target device maximum I/O
length but passed as-is.  Note that it is the responsability of the
target to remap and format the report reply.
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent a4aa5e56
...@@ -1152,6 +1152,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio, ...@@ -1152,6 +1152,7 @@ static int clone_bio(struct dm_target_io *tio, struct bio *bio,
return r; return r;
} }
if (bio_op(bio) != REQ_OP_ZONE_REPORT)
bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector)); bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector));
clone->bi_iter.bi_size = to_bytes(len); clone->bi_iter.bi_size = to_bytes(len);
...@@ -1341,7 +1342,11 @@ static int __split_and_process_non_flush(struct clone_info *ci) ...@@ -1341,7 +1342,11 @@ static int __split_and_process_non_flush(struct clone_info *ci)
if (!dm_target_is_valid(ti)) if (!dm_target_is_valid(ti))
return -EIO; return -EIO;
len = min_t(sector_t, max_io_len(ci->sector, ti), ci->sector_count); if (bio_op(bio) == REQ_OP_ZONE_REPORT)
len = ci->sector_count;
else
len = min_t(sector_t, max_io_len(ci->sector, ti),
ci->sector_count);
r = __clone_and_map_data_bio(ci, ti, ci->sector, &len); r = __clone_and_map_data_bio(ci, ti, ci->sector, &len);
if (r < 0) if (r < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment