Re: [PATCH 01/30] block: also call ->open for incremental partition opens

Christoph Hellwig
2023-08-28T12:10:27Z

On Fri, Aug 25, 2023 at 03:44:57AM +0100, Al Viro wrote:
> That got me curious about the ->bd_openers - do we need it atomic?
> Most of the users (and all places that do modifications) are
> under ->open_mutex; the only exceptions are
> * early sync logics in blkdev_put(); it's explicitly racy -
> see the comment there.
> * callers of disk_openers() in loop and nbd (the ones in
> zram are under ->open_mutex). There's driver-private exclusion
> around those, but in any case - READ_ONCE() is no worse than
> atomic_read() in those cases.
>
> Is there something subtle I'm missing here?

No. When I had to add unlocked readers I did the READ_ONCE initially,
but reviewers though the atomic_t would be better. I didn't really feel
like arguing so went with this version.