[PATCH rfc] nvme: support io stats on the mpath device
Sagi Grimberg
sagi at grimberg.me
Thu Sep 29 03:04:37 PDT 2022
On 9/28/22 22:55, Sagi Grimberg wrote:
> Our mpath stack device is just a shim that selects a bottom namespace
> and submits the bio to it without any fancy splitting. This also means
> that we don't clone the bio or have any context to the bio beyond
> submission. However it really sucks that we don't see the mpath device
> io stats.
>
> Given that the mpath device can't do that without adding some context
> to it, we let the bottom device do it on its behalf (somewhat similar
> to the approach taken in nvme_trace_bio_complete);
>
> Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
> ---
> drivers/nvme/host/apple.c | 2 +-
> drivers/nvme/host/core.c | 10 ++++++++++
> drivers/nvme/host/fc.c | 2 +-
> drivers/nvme/host/multipath.c | 18 ++++++++++++++++++
> drivers/nvme/host/nvme.h | 12 ++++++++++++
> drivers/nvme/host/pci.c | 2 +-
> drivers/nvme/host/rdma.c | 2 +-
> drivers/nvme/host/tcp.c | 2 +-
> drivers/nvme/target/loop.c | 2 +-
> 9 files changed, 46 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c
> index 5fc5ea196b40..6df4b8a5d8ab 100644
> --- a/drivers/nvme/host/apple.c
> +++ b/drivers/nvme/host/apple.c
> @@ -763,7 +763,7 @@ static blk_status_t apple_nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
> goto out_free_cmd;
> }
>
> - blk_mq_start_request(req);
> + nvme_start_request(req);
> apple_nvme_submit_cmd(q, cmnd);
> return BLK_STS_OK;
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 9bacfd014e3d..f42e6e40d84b 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -385,6 +385,8 @@ static inline void nvme_end_req(struct request *req)
> nvme_end_req_zoned(req);
> nvme_trace_bio_complete(req);
> blk_mq_end_request(req, status);
> + if (req->cmd_flags & REQ_NVME_MPATH)
> + nvme_mpath_end_request(req);
I guess the order should probably be reversed, because after
blk_mq_end_request req may become invalid and create UAF?
More information about the Linux-nvme
mailing list