]> git.baikalelectronics.ru Git - kernel.git/commit
dm mpath: fix missing call of path selector type->end_io
authorYufen Yu <yuyufen@huawei.com>
Wed, 24 Apr 2019 15:19:05 +0000 (23:19 +0800)
committerMike Snitzer <snitzer@redhat.com>
Thu, 25 Apr 2019 19:38:52 +0000 (15:38 -0400)
commit0eeebad6e0f991f3bffd5d03db8e11ab848a6a17
tree88cacc02c0a64090ce907c8544f6e7e1d0b13421
parentf5b9a3737a5b54d04a8f79c42d825f13aeac6f19
dm mpath: fix missing call of path selector type->end_io

After commit 525996e33959 ("blk-mq: improve DM's blk-mq IO merging via
blk_insert_cloned_request feedback"), map_request() will requeue the tio
when issued clone request return BLK_STS_RESOURCE or BLK_STS_DEV_RESOURCE.

Thus, if device driver status is error, a tio may be requeued multiple
times until the return value is not DM_MAPIO_REQUEUE.  That means
type->start_io may be called multiple times, while type->end_io is only
called when IO complete.

In fact, even without commit 525996e33959, setup_clone() failure can
also cause tio requeue and associated missed call to type->end_io.

The service-time path selector selects path based on in_flight_size,
which is increased by st_start_io() and decreased by st_end_io().
Missed calls to st_end_io() can lead to in_flight_size count error and
will cause the selector to make the wrong choice.  In addition,
queue-length path selector will also be affected.

To fix the problem, call type->end_io in ->release_clone_rq before tio
requeue.  map_info is passed to ->release_clone_rq() for map_request()
error path that result in requeue.

Fixes: 525996e33959 ("blk-mq: improve DM's blk-mq IO merging via blk_insert_cloned_request feedback")
Cc: stable@vger.kernl.org
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-mpath.c
drivers/md/dm-rq.c
drivers/md/dm-target.c
include/linux/device-mapper.h