Commit 6599c84e authored by Bart Van Assche's avatar Bart Van Assche Committed by Mike Snitzer

dm mpath: do not modify *__clone if blk_mq_alloc_request() fails

Purely cleanup, avoids potential for strange coding bugs.  But in
reality if __multipath_map() fails the caller has no business looking at
*__clone.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 4813577f
...@@ -580,16 +580,17 @@ static int __multipath_map(struct dm_target *ti, struct request *clone, ...@@ -580,16 +580,17 @@ static int __multipath_map(struct dm_target *ti, struct request *clone,
* .request_fn stacked on blk-mq path(s) and * .request_fn stacked on blk-mq path(s) and
* blk-mq stacked on blk-mq path(s). * blk-mq stacked on blk-mq path(s).
*/ */
*__clone = blk_mq_alloc_request(bdev_get_queue(bdev), clone = blk_mq_alloc_request(bdev_get_queue(bdev),
rq_data_dir(rq), BLK_MQ_REQ_NOWAIT); rq_data_dir(rq), BLK_MQ_REQ_NOWAIT);
if (IS_ERR(*__clone)) { if (IS_ERR(clone)) {
/* ENOMEM, requeue */ /* EBUSY, ENODEV or EWOULDBLOCK: requeue */
clear_request_fn_mpio(m, map_context); clear_request_fn_mpio(m, map_context);
return r; return r;
} }
(*__clone)->bio = (*__clone)->biotail = NULL; clone->bio = clone->biotail = NULL;
(*__clone)->rq_disk = bdev->bd_disk; clone->rq_disk = bdev->bd_disk;
(*__clone)->cmd_flags |= REQ_FAILFAST_TRANSPORT; clone->cmd_flags |= REQ_FAILFAST_TRANSPORT;
*__clone = clone;
} }
if (pgpath->pg->ps.type->start_io) if (pgpath->pg->ps.type->start_io)
......
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