Re: [PATCH v2 17/26] loop: Add lock context annotations

Christoph Hellwig
2026-03-26T14:18:36Z

On Wed, Mar 25, 2026 at 02:44:58PM -0700, Bart Van Assche wrote:
> Add lock context annotations that are compatible with Clang and enable
> lock context analysis.
>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/block/loop.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> index 0000913f7efc..9c7ed9e8a442 100644
> --- a/drivers/block/loop.c
> +++ b/drivers/block/loop.c
> @@ -107,6 +107,8 @@ static DEFINE_MUTEX(loop_validate_mutex);
> * loop_configure()/loop_change_fd()/__loop_clr_fd() calls.
> */
> static int loop_global_lock_killable(struct loop_device *lo, bool global)
> + __cond_acquires(0, &lo->lo_mutex)
> + __no_context_analysis /* conditional locking */

There's not explanation here why this is needed.