Re: [PATCH 2/9] w1: remove the master's files before taking its locks

From: Krzysztof Kozlowski

Date: Fri Oct 30 2026 - 09:01:55 EST


On 27/10/2026 17:04, Greg Kroah-Hartman wrote:
> From: Josef Bacik <josef@xxxxxxxxxxxxxx>
>
> __w1_remove_master_device() calls w1_destroy_master_attributes() with
> both the mutex of the master and list_mutex held. Removing the files
> waits for the callbacks which are running, and nearly all of them take
> one of these two locks:
>
> __w1_remove_master_device() read() of .../w1_master_slaves
> mutex_lock(&dev->mutex) kernfs active reference
> mutex_lock(&dev->list_mutex) w1_master_attribute_show_slaves()
> w1_destroy_master_attributes() mutex_lock(&md->list_mutex)
> sysfs_remove_group() waits
> waits for the reference


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>

Best regards,
Krzysztof