dm mpath: fix missing call of path selector type->end_io
PATCH v2 1/1 dm mpath: fix missing call of path selector type->end_io
After commit 396eaf21ee17 ("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 drive 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 tims, while type->end_io just be called when IO complete.
In fact, even without the commit, setup_clone() fail also can make the tio requeue and miss call type->end_io.
As servicer-time path selector for example, it selects path based on in_flight_size, which is increased by st_start_io() and decreased by st_end_io(). Missing call of end_io can lead to in_flight_size count error and let the selector make the wrong choice. In addition, queue-length path selector will also be affected.
To fix the problem, we call type->end_io in ->release_clone_rq before tio requeue. It pass map_info to ->release_clone_rq() for requeue path, and pass NULL for the others path.
---
V2:
- remove the new added interface ->end_stat() in V1
- use ->release_clone_rq() to call path selector ->end_io
- add dm_rq_status to show clone status
V1:
- https://www.redhat.com/archives/dm-devel/2019-April/msg00148.html
--- drivers/md/dm-mpath.c | 20 +++++++++++++++++++- drivers/md/dm-rq.c | 19 ++++++++++++++----- drivers/md/dm-target.c | 4 +++- include/linux/device-mapper.h | 13 ++++++++++++- 4 files changed, 48 insertions(+), 8 deletions(-)
drivers/md/dm-mpath.c +19 -1
@@ -544,8 +544,26 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,return DM_MAPIO_REMAPPED ; } -static void multipath_release_clone (struct request *clone) +static void multipath_release_clone (struct request *clone, + union map_info *map_context + enum dm_rq_status clone_status) { +struct dm_mpath_io *mpio; +struct pgpath *pgpath; + +if (clone_status !=DM_CLONE_RQ_OK && !map_context) { + mpio =get_mpio (map_context); + pgpath = mpio->pgpath; + +if (pgpath) { +struct path_selector *ps = &pgpath->pg->ps; + +if (ps->type->end_io) + ps->type->end_io (ps, &pgpath->path, + mpio->nr_bytes); + } + } +blk_put_request (clone); }
drivers/md/dm-rq.c +14 -5
@@ -168,7 +168,7 @@ static void dm_end_request(struct request *clone, blk_status_t error)struct request *rq = tio->orig;blk_rq_unprep_clone (clone); - tio->ti->type->release_clone_rq (clone); + tio->ti->type->release_clone_rq (clone,NULL ,DM_CLONE_RQ_OK );rq_end_stats (md, rq);blk_mq_end_request (rq, error);
@@ -201,7 +201,7 @@ static void dm_requeue_original_request(struct dm_rq_target_io *tio, bool delay_rq_end_stats (md, rq);if (tio->clone) {blk_rq_unprep_clone (tio->clone); - tio->ti->type->release_clone_rq (tio->clone); + tio->ti->type->release_clone_rq (tio->clone,NULL ,DM_CLONE_RQ_OK ); }dm_mq_delay_requeue_request (rq, delay_ms);
@@ -397,8 +397,12 @@ static int map_request(struct dm_rq_target_io *tio)break ;case DM_MAPIO_REMAPPED :if (setup_clone (clone, rq, tio,GFP_ATOMIC )) { -/* -ENOMEM */ - ti->type->release_clone_rq (clone); +/* -ENOMEM +* For multipath, before requeue, we need to pass tio->info +* to release_clone_rq, avoiding missing call of path sector +* ->end_io. +*/ + ti->type->release_clone_rq (clone, &tio->info,DM_CLONE_RQ_CANCAL );return DM_MAPIO_REQUEUE ; }
@@ -408,7 +412,12 @@ static int map_request(struct dm_rq_target_io *tio) ret =dm_dispatch_clone_request (clone, rq);if (ret ==BLK_STS_RESOURCE || ret ==BLK_STS_DEV_RESOURCE ) {blk_rq_unprep_clone (clone); - tio->ti->type->release_clone_rq (clone); +/* +* For multipath, before requeue, we need to pass tio->info +* to release_clone_rq, avoiding missing call of path sector +* ->end_io. +*/ + tio->ti->type->release_clone_rq (clone, &tio->info,DM_CLONE_RQ_CANCAL ); tio->clone =NULL ;return DM_MAPIO_REQUEUE ; }
drivers/md/dm-target.c +3 -1
@@ -136,7 +136,9 @@ static int io_err_clone_and_map_rq(struct dm_target *ti, struct request *rq,return DM_MAPIO_KILL ; } -static void io_err_release_clone_rq (struct request *clone) +static void io_err_release_clone_rq (struct request *clone, +union map_info *map_context, +enum dm_rq_status clone_status) { }
include/linux/device-mapper.h +12 -1
@@ -31,6 +31,15 @@ enum dm_queue_mode { DM_TYPE_NVME_BIO_BASED = 4, }; +/* +* clone request status +*/ +enum dm_rq_status { +DM_CLONE_RQ_OK , +DM_CLONE_RQ_CANCAL , +DM_CLONE_RQ_MAX , +}; +typedef enum {STATUSTYPE_INFO ,STATUSTYPE_TABLE }status_type_t ;union map_info {
@@ -62,7 +71,9 @@ typedef int (*dm_clone_and_map_request_fn) (struct dm_target *ti,struct request *rq, union map_info *map_context, struct request **clone); -typedef void (*dm_release_clone_request_fn ) (struct request *clone); +typedef void (*dm_release_clone_request_fn ) (struct request *clone, +union map_info *map_context, +enum dm_rq_status clone_status);/* * Returns:
Signature · 1 line
2.16.2.dirty
Quoted 61 lines · Yufen Yu
After commit
396eaf21ee17("blk-mq: improve DM's blk-mq IO merging viablk_insert_cloned_requestfeedback"),map_request()will requeue the tio
when issued clone request returnBLK_STS_RESOURCEorBLK_STS_DEV_RESOURCE.Thus, if device drive status is error, a tio may be requeued multiple times
until the return value is notDM_MAPIO_REQUEUE. That means type-Quoted 1 line
start_iomay be called multiple tims, while
type->end_iojust be called when IO
complete.In fact, even without the commit,
setup_clone()fail also can make the
tio requeue and miss calltype->end_io.As servicer-time path selector for example, it selects path based on
in_flight_size, which is increased byst_start_io()and decreased byst_end_io(). Missing call ofend_iocan lead toin_flight_sizecount error and let the selector make the wrong choice. In addition, queue-length path selector will also be affected.To fix the problem, we call
type->end_ioin ->release_clone_rq before tio requeue. It passmap_infoto ->release_clone_rq() for requeue path,
and pass NULL for the others path.Fixes 396eaf21ee17 ("blk-mq: improve DM's blk-mq IO merging via
blk_insert_cloned_requestfeedback")Cc Ming Lei <[email protected]>Cc Martin Wilck <[email protected]>Cc Mikulas Patocka <[email protected]>Cc Hou Tao <[email protected]>Signed-off-by Yufen Yu <[email protected]>---
V2:
- remove the new added interface ->end_stat() in V1
- use ->release_clone_rq() to call path selector ->end_io
- adddm_rq_statusto show clone statusV1:
- https://www.redhat.com/archives/dm-devel/2019-April/msg00148.html--- drivers/md/dm-mpath.c | 20 +++++++++++++++++++- drivers/md/dm-rq.c | 19 ++++++++++++++----- drivers/md/dm-target.c | 4 +++- include/linux/device-mapper.h | 13 ++++++++++++- 4 files changed, 48 insertions(+), 8 deletions(-)drivers/md/dm-mpath.c +0
-0@@ -544,8 +544,26 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, return DM_MAPIO_REMAPPED; }
drivers/md/dm-mpath.c static int multipath_clone_and_map(struct · line 555
Quoted 10 lines
drivers/md/dm-mpath.c +7
-1-static void multipath_release_clone (struct request *clone) +static void multipath_release_clone (struct request *clone, + union map_info *map_context + enum dm_rq_status clone_status) { +struct dm_mpath_io *mpio; +struct pgpath *pgpath; + +if (clone_status !=DM_CLONE_RQ_OK && !map_context) {
Should this be "... && map_context)", maybe ?
Quoted 101 lines
drivers/md/dm-mpath.c +12
-0+ mpio =get_mpio (map_context); + pgpath = mpio->pgpath; + +if (pgpath) { +struct path_selector *ps = &pgpath->pg->ps; + +if (ps->type->end_io) + ps->type->end_io (ps, &pgpath->path, + mpio->nr_bytes); + } + } +blk_put_request (clone); }drivers/md/dm-rq.c +1
-1@@ -168,7 +168,7 @@ static void dm_end_request(struct request *clone, blk_status_t error)struct request *rq = tio->orig;blk_rq_unprep_clone (clone); - tio->ti->type->release_clone_rq (clone); + tio->ti->type->release_clone_rq (clone,NULL ,DM_CLONE_RQ_OK );rq_end_stats (md, rq);drivers/md/dm-rq.c +0
-0blk_mq_end_request (rq, error);@@ -201,7 +201,7 @@ static void dm_requeue_original_request(struct
dm_rq_target_io*tio, booldelay_drivers/md/dm-rq.c +1
-1rq_end_stats (md, rq);if (tio->clone) {blk_rq_unprep_clone (tio->clone); - tio->ti->type->release_clone_rq (tio->clone); + tio->ti->type->release_clone_rq(tio->clone, NULL,
DM_CLONE_RQ_OK);drivers/md/dm-rq.c +2
-2}dm_mq_delay_requeue_request (rq, delay_ms);@@ -397,8 +397,12 @@ static int map_request(struct dm_rq_target_io *tio)break ;case DM_MAPIO_REMAPPED :if (setup_clone (clone, rq, tio,GFP_ATOMIC )) { -/* -ENOMEM */ - ti->type->release_clone_rq (clone); +/* -ENOMEM +* For multipath, before requeue, we need to pass
tio->infodrivers/md/dm-rq.c +1
-0+* to release_clone_rq, avoiding missing call of path sector
drivers/md/dm-rq.c +3
-0+* ->end_io. +*/ + ti->type->release_clone_rq(clone, &tio->info,
DM_CLONE_RQ_CANCAL);drivers/md/dm-rq.c +2
-1return DM_MAPIO_REQUEUE ; }@@ -408,7 +412,12 @@ static int map_request(struct dm_rq_target_io *tio) ret =dm_dispatch_clone_request (clone, rq);if (ret ==BLK_STS_RESOURCE || ret ==BLK_STS_DEV_RESOURCE ) {blk_rq_unprep_clone (clone); - tio->ti->type->release_clone_rq (clone); +/* +* For multipath, before requeue, we need to pass
tio->infodrivers/md/dm-rq.c +1
-0+* to release_clone_rq, avoiding missing call of path sector
drivers/md/dm-rq.c +3
-0+* ->end_io. +*/ + tio->ti->type->release_clone_rq(clone, &tio-Quoted 1 line
info,
DM_CLONE_RQ_CANCAL);drivers/md/dm-rq.c +0
-0tio->clone =NULL ;return DM_MAPIO_REQUEUE ; }drivers/md/dm-target.c +3
-1@@ -136,7 +136,9 @@ static int io_err_clone_and_map_rq(struct dm_target *ti, struct request *rq, return DM_MAPIO_KILL; } -static void io_err_release_clone_rq (struct request *clone) +static void io_err_release_clone_rq (struct request *clone, +union map_info *map_context, +enum dm_rq_status clone_status) { }include/linux/device- renamed from include/linux/device-mapper.h +0
-0
mapper.h
indexb0672756d056..9b9ab762a992100644include/linux/device-mapper.h +0
-0@@ -31,6 +31,15 @@ enum dm_queue_mode { DM_TYPE_NVME_BIO_BASED = 4,
include/linux/device-mapper.h enum dm_queue_mode { · line 41
Quoted 10 lines
include/linux/device-mapper.h +8
-0}; +/* +* clone request status +*/ +enum dm_rq_status { +DM_CLONE_RQ_OK , +DM_CLONE_RQ_CANCAL , +DM_CLONE_RQ_MAX , +};
"CANCAL" looks strange - did you mean "CANCEL"?
Anyway, what do you need this new enum for? Couldn't you just pass the disposition (i.e. DM_MAPIO_REQUEUE), and use a different value (e.g. DM_ENDIO_DONE) at those call sites where end_io shouldn't be called?
Regards,
Martin
Quoted 63 lines · Martin Wilck
Quoted 62 lines · Yufen Yu
After commit
396eaf21ee17("blk-mq: improve DM's blk-mq IO merging viablk_insert_cloned_requestfeedback"),map_request()will requeue the tio
when issued clone request returnBLK_STS_RESOURCEorBLK_STS_DEV_RESOURCE.Thus, if device drive status is error, a tio may be requeued multiple times
until the return value is notDM_MAPIO_REQUEUE. That means type-Quoted 1 line
start_iomay be called multiple tims, while
type->end_iojust be called when IO
complete.In fact, even without the commit,
setup_clone()fail also can make the
tio requeue and miss calltype->end_io.As servicer-time path selector for example, it selects path based on
in_flight_size, which is increased byst_start_io()and decreased byst_end_io(). Missing call ofend_iocan lead toin_flight_sizecount error and let the selector make the wrong choice. In addition, queue-length path selector will also be affected.To fix the problem, we call
type->end_ioin ->release_clone_rq before tio requeue. It passmap_infoto ->release_clone_rq() for requeue path,
and pass NULL for the others path.Fixes 396eaf21ee17 ("blk-mq: improve DM's blk-mq IO merging via
blk_insert_cloned_requestfeedback")Cc Ming Lei <[email protected]>Cc Martin Wilck <[email protected]>Cc Mikulas Patocka <[email protected]>Cc Hou Tao <[email protected]>Signed-off-by Yufen Yu <[email protected]>---
V2:
- remove the new added interface ->end_stat() in V1
- use ->release_clone_rq() to call path selector ->end_io
- adddm_rq_statusto show clone statusV1:
- https://www.redhat.com/archives/dm-devel/2019-April/msg00148.html--- drivers/md/dm-mpath.c | 20 +++++++++++++++++++- drivers/md/dm-rq.c | 19 ++++++++++++++----- drivers/md/dm-target.c | 4 +++- include/linux/device-mapper.h | 13 ++++++++++++- 4 files changed, 48 insertions(+), 8 deletions(-)drivers/md/dm-mpath.c +0
-0@@ -544,8 +544,26 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, return DM_MAPIO_REMAPPED; }
Quoted 10 lines
drivers/md/dm-mpath.c static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, · line 554
Quoted 9 lines
drivers/md/dm-mpath.c +7
-1-static void multipath_release_clone (struct request *clone) +static void multipath_release_clone (struct request *clone, + union map_info *map_context + enum dm_rq_status clone_status) { +struct dm_mpath_io *mpio; +struct pgpath *pgpath; + +if (clone_status !=DM_CLONE_RQ_OK && !map_context) {Should this be "... &&
map_context)", maybe ?
Yes, thanks for catching this! This is an obvious error.
Quoted 104 lines
Quoted 104 lines
drivers/md/dm-mpath.c +12
-0+ mpio =get_mpio (map_context); + pgpath = mpio->pgpath; + +if (pgpath) { +struct path_selector *ps = &pgpath->pg->ps; + +if (ps->type->end_io) + ps->type->end_io (ps, &pgpath->path, + mpio->nr_bytes); + } + } +blk_put_request (clone); }drivers/md/dm-rq.c +1
-1@@ -168,7 +168,7 @@ static void dm_end_request(struct request *clone, blk_status_t error)struct request *rq = tio->orig;blk_rq_unprep_clone (clone); - tio->ti->type->release_clone_rq (clone); + tio->ti->type->release_clone_rq (clone,NULL ,DM_CLONE_RQ_OK );rq_end_stats (md, rq);blk_mq_end_request(rq, error);drivers/md/dm-rq.c +0
-0@@ -201,7 +201,7 @@ static void dm_requeue_original_request(struct
dm_rq_target_io*tio, booldelay_
rq_end_stats(md, rq);
if (tio->clone) {
blk_rq_unprep_clone(tio->clone);drivers/md/dm-rq.c +1
-1- tio->ti->type->release_clone_rq (tio->clone); + tio->ti->type->release_clone_rq(tio->clone, NULL,
DM_CLONE_RQ_OK);
}dm_mq_delay_requeue_request(rq, delay_ms);drivers/md/dm-rq.c +2
-2@@ -397,8 +397,12 @@ static int map_request(struct dm_rq_target_io *tio)break ;case DM_MAPIO_REMAPPED :if (setup_clone (clone, rq, tio,GFP_ATOMIC )) { -/* -ENOMEM */ - ti->type->release_clone_rq (clone); +/* -ENOMEM +* For multipath, before requeue, we need to pass
tio->infodrivers/md/dm-rq.c +1
-0+* to release_clone_rq, avoiding missing call of path sector
drivers/md/dm-rq.c +3
-0+* ->end_io. +*/ + ti->type->release_clone_rq(clone, &tio->info,
DM_CLONE_RQ_CANCAL);
returnDM_MAPIO_REQUEUE;
}drivers/md/dm-rq.c +2
-1@@ -408,7 +412,12 @@ static int map_request(struct dm_rq_target_io *tio) ret =dm_dispatch_clone_request (clone, rq);if (ret ==BLK_STS_RESOURCE || ret ==BLK_STS_DEV_RESOURCE ) {blk_rq_unprep_clone (clone); - tio->ti->type->release_clone_rq (clone); +/* +* For multipath, before requeue, we need to pass
tio->infodrivers/md/dm-rq.c +1
-0+* to release_clone_rq, avoiding missing call of path sector
drivers/md/dm-rq.c +3
-0+* ->end_io. +*/ + tio->ti->type->release_clone_rq(clone, &tio-Quoted 1 line
info,
DM_CLONE_RQ_CANCAL);
tio->clone= NULL;
returnDM_MAPIO_REQUEUE;
}drivers/md/dm-target.c +3
-1@@ -136,7 +136,9 @@ static int io_err_clone_and_map_rq(struct dm_target *ti, struct request *rq, return DM_MAPIO_KILL; } -static void io_err_release_clone_rq (struct request *clone) +static void io_err_release_clone_rq (struct request *clone, +union map_info *map_context, +enum dm_rq_status clone_status) { }include/linux/device- renamed from include/linux/device-mapper.h +0
-0
mapper.h
indexb0672756d056..9b9ab762a992100644include/linux/device-mapper.h +0
-0@@ -31,6 +31,15 @@ enum dm_queue_mode { DM_TYPE_NVME_BIO_BASED = 4, };
Quoted 9 lines
include/linux/device-mapper.h enum dm_queue_mode { · line 41
Quoted 8 lines
include/linux/device-mapper.h +8
-0+/* +* clone request status +*/ +enum dm_rq_status { +DM_CLONE_RQ_OK , +DM_CLONE_RQ_CANCAL , +DM_CLONE_RQ_MAX , +};"CANCAL" looks strange - did you mean "CANCEL"?
This is a spelling error.
Quoted 11 lines
Anyway, what do you need this new enum for? Couldn't you just pass the disposition (i.e.
DM_MAPIO_REQUEUE), and use a different value (e.g.DM_ENDIO_DONE) at those call sites whereend_ioshouldn't be called?Regards,
Martin.
Thanks for your suggestion. Passing DM_MAPIO_REQUEUE is a good idea. It indicates that request will be requeued and we need to call ->end_io.
However, I am not sure if it is suitable for use DM_ENDIO_DONE. It is strange that we use DM_ENDIO_DONE in dm_requeue_original_request(), which is called in the case of DM_ENDIO_REQUEUE in dm_done().
Yufen
Thanks a lot.
Quoted 198 lines · yuyufen
Quoted 64 lines · Martin Wilck
Quoted 63 lines · Yufen Yu
After commit
396eaf21ee17("blk-mq: improve DM's blk-mq IO merging viablk_insert_cloned_requestfeedback"),map_request()will requeue the tio
when issued clone request returnBLK_STS_RESOURCEorBLK_STS_DEV_RESOURCE.Thus, if device drive status is error, a tio may be requeued multiple times
until the return value is notDM_MAPIO_REQUEUE. That means type-Quoted 1 line
start_iomay be called multiple tims, while
type->end_iojust be called when IO
complete.In fact, even without the commit,
setup_clone()fail also can make the
tio requeue and miss calltype->end_io.As servicer-time path selector for example, it selects path based on
in_flight_size, which is increased byst_start_io()and decreased byst_end_io(). Missing call ofend_iocan lead toin_flight_sizecount error and let the selector make the wrong choice. In addition, queue-length path selector will also be affected.To fix the problem, we call
type->end_ioin ->release_clone_rq before tio requeue. It passmap_infoto ->release_clone_rq() for requeue path,
and pass NULL for the others path.Fixes 396eaf21ee17 ("blk-mq: improve DM's blk-mq IO merging via
blk_insert_cloned_requestfeedback")Cc Ming Lei <[email protected]>Cc Martin Wilck <[email protected]>Cc Mikulas Patocka <[email protected]>Cc Hou Tao <[email protected]>Signed-off-by Yufen Yu <[email protected]>---
V2:
- remove the new added interface ->end_stat() in V1
- use ->release_clone_rq() to call path selector ->end_io
- adddm_rq_statusto show clone statusV1:
- https://www.redhat.com/archives/dm-devel/2019-April/msg00148.html--- drivers/md/dm-mpath.c | 20 +++++++++++++++++++- drivers/md/dm-rq.c | 19 ++++++++++++++----- drivers/md/dm-target.c | 4 +++- include/linux/device-mapper.h | 13 ++++++++++++- 4 files changed, 48 insertions(+), 8 deletions(-)drivers/md/dm-mpath.c +1
-1@@ -544,8 +544,26 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, return DM_MAPIO_REMAPPED; } -static void multipath_release_clone (struct request *clone) +static void multipath_release_clone(struct request *clone,Quoted 8 lines
drivers/md/dm-mpath.c static int multipath_clone_and_map(struct dm_target *ti, struct request *rq, · line 554
Quoted 7 lines
drivers/md/dm-mpath.c +6
-0+ union map_info *map_context + enum dm_rq_status clone_status) { +struct dm_mpath_io *mpio; +struct pgpath *pgpath; + +if (clone_status !=DM_CLONE_RQ_OK && !map_context) {Should this be "... &&
map_context)", maybe ?Yes, thanks for catching this! This is an obvious error.
Quoted 97 lines
Quoted 97 lines
drivers/md/dm-mpath.c +12
-0+ mpio =get_mpio (map_context); + pgpath = mpio->pgpath; + +if (pgpath) { +struct path_selector *ps = &pgpath->pg->ps; + +if (ps->type->end_io) + ps->type->end_io (ps, &pgpath->path, + mpio->nr_bytes); + } + } +blk_put_request (clone); }drivers/md/dm-rq.c +1
-1@@ -168,7 +168,7 @@ static void dm_end_request(struct request *clone, blk_status_t error)struct request *rq = tio->orig;blk_rq_unprep_clone (clone); - tio->ti->type->release_clone_rq (clone); + tio->ti->type->release_clone_rq (clone,NULL ,DM_CLONE_RQ_OK );rq_end_stats (md, rq);blk_mq_end_request (rq, error);@@ -201,7 +201,7 @@ static void dm_requeue_original_request(struct
dm_rq_target_io*tio, booldelay_drivers/md/dm-rq.c +1
-1rq_end_stats (md, rq);if (tio->clone) {blk_rq_unprep_clone (tio->clone); - tio->ti->type->release_clone_rq (tio->clone); + tio->ti->type->release_clone_rq(tio->clone, NULL,
DM_CLONE_RQ_OK);drivers/md/dm-rq.c +2
-2}dm_mq_delay_requeue_request (rq, delay_ms);@@ -397,8 +397,12 @@ static int map_request(struct dm_rq_target_io *tio)break ;case DM_MAPIO_REMAPPED :if (setup_clone (clone, rq, tio,GFP_ATOMIC )) { -/* -ENOMEM */ - ti->type->release_clone_rq (clone); +/* -ENOMEM +* For multipath, before requeue, we need to pass
tio->infodrivers/md/dm-rq.c +1
-0+* to release_clone_rq, avoiding missing call of path sector
drivers/md/dm-rq.c +3
-0+* ->end_io. +*/ + ti->type->release_clone_rq(clone, &tio->info,
DM_CLONE_RQ_CANCAL);drivers/md/dm-rq.c +2
-1return DM_MAPIO_REQUEUE ; }@@ -408,7 +412,12 @@ static int map_request(struct dm_rq_target_io *tio) ret =dm_dispatch_clone_request (clone, rq);if (ret ==BLK_STS_RESOURCE || ret ==BLK_STS_DEV_RESOURCE ) {blk_rq_unprep_clone (clone); - tio->ti->type->release_clone_rq (clone); +/* +* For multipath, before requeue, we need to pass
tio->infodrivers/md/dm-rq.c +1
-0+* to release_clone_rq, avoiding missing call of path sector
drivers/md/dm-rq.c +3
-0+* ->end_io. +*/ + tio->ti->type->release_clone_rq(clone, &tio-Quoted 1 line
info,
DM_CLONE_RQ_CANCAL);drivers/md/dm-rq.c +0
-0tio->clone =NULL ;return DM_MAPIO_REQUEUE ; }drivers/md/dm-target.c +3
-1@@ -136,7 +136,9 @@ static int io_err_clone_and_map_rq(struct dm_target *ti, struct request *rq, return DM_MAPIO_KILL; } -static void io_err_release_clone_rq (struct request *clone) +static void io_err_release_clone_rq (struct request *clone, +union map_info *map_context, +enum dm_rq_status clone_status) { }include/linux/device- renamed from include/linux/device-mapper.h +0
-0
mapper.h
indexb0672756d056..9b9ab762a992100644include/linux/device-mapper.h +1
-0@@ -31,6 +31,15 @@ enum dm_queue_mode { DM_TYPE_NVME_BIO_BASED = 4, }; +/* Quoted 8 lines
include/linux/device-mapper.h enum dm_queue_mode { · line 41
Quoted 7 lines
include/linux/device-mapper.h +7
-0+* clone request status +*/ +enum dm_rq_status { +DM_CLONE_RQ_OK , +DM_CLONE_RQ_CANCAL , +DM_CLONE_RQ_MAX , +};"CANCAL" looks strange - did you mean "CANCEL"?
This is a spelling error.
Quoted 11 lines
Anyway, what do you need this new enum for? Couldn't you just pass the disposition (i.e.
DM_MAPIO_REQUEUE), and use a different value (e.g.DM_ENDIO_DONE) at those call sites whereend_ioshouldn't be called?Regards,
Martin.
Quoted 6 lines
Thanks for your suggestion. Passing
DM_MAPIO_REQUEUEis a good idea. It indicates that request will be requeued and we need to call ->end_io.However, I am not sure if it is suitable for use
DM_ENDIO_DONE. It is strange that we useDM_ENDIO_DONEindm_requeue_original_request(), which is called in the case ofDM_ENDIO_REQUEUEindm_done().
I've staged the following, it doesn't get bogged down with passing flags (and overloading their use with unnatural new meanings). Please let me know if you see any issues:
Thanks,
Mike
Martin Wilck
Reviewed-byQuoted 31 lines · Mike Snitzer
Quoted 23 lines · yuyufen
Quoted 1 line
"CANCAL" looks strange - did you mean "CANCEL"?
This is a spelling error.
Quoted 7 lines
Anyway, what do you need this new enum for? Couldn't you just pass the
disposition (i.e.DM_MAPIO_REQUEUE), and use a different value (e.g.DM_ENDIO_DONE) at those call sites whereend_ioshouldn't be called?Quoted 6 lines
Regards,
Martin.
Thanks for your suggestion. Passing
DM_MAPIO_REQUEUEis a good idea.
It indicates that request will be requeued and we need to call ->end_io.Quoted 4 lines
However, I am not sure if it is suitable for use
DM_ENDIO_DONE. It is strange that we useDM_ENDIO_DONEindm_requeue_original_request(),
which is called in the case ofDM_ENDIO_REQUEUEindm_done().
Quoted 7 lines
I've staged the following, it doesn't get bogged down with passing flags
(and overloading their use with unnatural new meanings). Please let me
know if you see any issues:
Nice and simple. Looks good to me.