Re: [PATCH RESEND 2/5] blk-wbt: fix incorrect lock order for rq_qos_mutex and freeze queue
From: Nilay Shroff
Date: Mon Nov 17 2025 - 05:19:43 EST
On 11/16/25 9:40 AM, Yu Kuai wrote:
> wbt_init() can be called from sysfs attribute and wbt_enable_default(),
> however the lock order are inversely.
>
> - queue_wb_lat_store() freeze queue first, and then wbt_init() hold
> rq_qos_mutex. In this case queue will be freezed again inside
> rq_qos_add(), however, in this case freeze queue recursivly is
> inoperative;
> - wbt_enable_default() from elevator switch will hold rq_qos_mutex
> first, and then rq_qos_add() will freeze queue;
>
> Fix this problem by converting to use new helper rq_qos_add_freezed() in
> wbt_init(), and for wbt_enable_default(), freeze queue before calling
> wbt_init().
>
> Fixes: a13bd91be223 ("block/rq_qos: protect rq_qos apis with a new lock")
> Signed-off-by: Yu Kuai <yukuai@xxxxxxxxx>
Looks good to me:
Reviewed-by: Nilay Shroff <nilay@xxxxxxxxxxxxx>