Re: [PATCH v3 02/12] block/bdev: Annotate the blk_holder_ops callback invocations

Marco Elver
2026-04-10T22:44:21Z

On Fri, 10 Apr 2026 at 19:17, Bart Van Assche <bvanassche@acm.org> wrote:
> On 4/9/26 6:27 AM, Marco Elver wrote:
> > On Thu, 9 Apr 2026 at 08:42, Christoph Hellwig <hch@lst.de> wrote:
> >> On Thu, Apr 02, 2026 at 11:39:34AM -0700, Bart Van Assche wrote:
> >>> The four callback functions in blk_holder_ops all release the
> >>> bd_holder_lock. Add __release() annotations where appropriate to prepare
> >>> for enabling thread-safety analysis. Explicit __release() annotations have
> >>> been added since Clang does not support adding a __releases() annotation
> >>> to a function pointer.
> >>
> >> I have to say I still hate this with passion. If we can't propagate
> >> the lock context over function pointers it isn't ready for prime time
> >> unfortunately, as much as I'm looking forward to it.
> >
> > Let's see if we can land this: https://github.com/llvm/llvm-project/pull/191187
> >
> > I think we'll be bumping min Clang version to 23 for context analysis,
> > so hopefully it'll be included in Clang 23 and should solve the
> > function pointer false positives.
>
> That LLVM patch does not seem sufficient to address Christoph's concern.
> If I apply that LLVM patch on my local LLVM tree, and if I apply the
> following patch to the Linux kernel source tree:
[...]
> ./include/linux/blkdev.h:1763:15: error: use of undeclared identifier 'bdev'
> 1763 | __releases(&bdev->bd_holder_lock);
> | ^~~~

I just pushed a fix: https://github.com/llvm/llvm-project/pull/191187

Can you retry? Thanks!