[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9e0301fe-9a22-4f5f-b42d-3bd3bae8d6da@acm.org>
Date: Mon, 1 Dec 2025 08:40:59 -0800
From: Bart Van Assche <bvanassche@....org>
To: YangYang <yang.yang@...o.com>, "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Jens Axboe <axboe@...nel.dk>, Pavel Machek <pavel@...nel.org>,
Len Brown <lenb@...nel.org>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>, Danilo Krummrich <dakr@...nel.org>,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: Re: [PATCH 1/2] PM: runtime: Fix I/O hang due to race between resume
and runtime disable
On 11/27/25 3:29 AM, YangYang wrote:
> diff --git a/block/blk-core.c b/block/blk-core.c
> index 66fb2071d..041d29ba4 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -323,12 +323,15 @@ int blk_queue_enter(struct request_queue *q,
> blk_mq_req_flags_t flags)
> * reordered.
> */
> smp_rmb();
> - wait_event(q->mq_freeze_wq,
> - (!q->mq_freeze_depth &&
> - blk_pm_resume_queue(pm, q)) ||
> - blk_queue_dying(q));
> +check:
> + wait_event(q->mq_freeze_wq, !q->mq_freeze_depth);
> +
> if (blk_queue_dying(q))
> return -ENODEV;
This can't work. blk_mq_destroy_queue() freezes a request queue without
unfreezing it so the above code will introduce a deadlock and/or a use-
after-free if it executes concurrently with blk_mq_destroy_queue().
Bart.
Powered by blists - more mailing lists