Re: [PATCH] blk-mq: initialize csd/fifo_time before use
From: Christoph Hellwig
Date: Mon Oct 10 2022 - 03:43:52 EST
On Mon, Oct 10, 2022 at 03:19:16PM +0800, Yuwei Guan wrote:
> csd/fifo_time need to be initialized before use again,
> otherwise, it will keep the last tag value.
>
> Signed-off-by: Yuwei Guan <Yuwei.Guan@xxxxxxxxxxxxx>
> ---
> block/blk-mq.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 8070b6c10e8d..f55d41f1d150 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -383,6 +383,9 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
> rq->end_io = NULL;
> rq->end_io_data = NULL;
>
> + /* initialize csd/fifo_time before use */
> + memset(&rq->csd, 0x0, sizeof(rq->csd));
This is a rather unusual spelling of 0. But more importantly what
problem with reuse do you actually see here? The csd is always
initialized before use as it can't otherwise work. fifo_time
also appears to, but the code is a bit convoluted.