Re: [PATCH v2 02/26] block: Annotate the block device functions

Bart Van Assche
2026-03-26T15:55:34Z

On 3/25/26 11:25 PM, Christoph Hellwig wrote:
> On Wed, Mar 25, 2026 at 02:44:43PM -0700, Bart Van Assche wrote:
>> mutex_lock(&bdev->bd_holder_lock);
>> - if (bdev->bd_holder_ops && bdev->bd_holder_ops->mark_dead)
>> + if (bdev->bd_holder_ops && bdev->bd_holder_ops->mark_dead) {
>> bdev->bd_holder_ops->mark_dead(bdev, surprise);
>> - else {
>> + /* bdev->bd_holder_ops->mark_dead() released bd_holder_lock */
>> + __release(&bdev->bd_holder_lock);
>
> This sounds like ->mark_dead also needs matching annotations. Or
> can we have a way to annotate the expexcted lock context changes on
> indirect function calls, as that would be very useful in general.

(+Marco)

Agreed that this would be useful.

Marco, is my understanding correct that Clang does not yet support
adding lock context annotations to function pointers and hence that
adding this support would require modifying the Clang compiler?

Thanks,

Bart.