Re: [PATCH 5/9] block: introduce holder ops

Christoph Hellwig
2023-05-17T07:30:37Z

On Tue, May 16, 2023 at 07:36:26AM -0700, Darrick J. Wong wrote:
> > > + mutex_lock(&bdev->bd_holder_lock);
> > > bdev->bd_holder = holder;
> > > + bdev->bd_holder_ops = hops;
> > > + mutex_unlock(&bdev->bd_holder_lock);
> > > bd_clear_claiming(whole, holder);
> > > mutex_unlock(&bdev_lock);
> > > }
> >
> > I guess the holder ops may be override in case of multiple claim, can
> > this be one problem from the holder ops user viewpoint? Or
> > warn_on_once(bdev->bd_holder_ops && bdev->bd_holder_ops != hops) is needed here?
>
> <shrug> I'd have thought bd_may_claim would suffice for detecting
> multiple claims based on its "bd_holder != NULL" test?
>
> Though I suppose an explicit test for bd_holder_ops != NULL would
> prevent multiple claims if all the claims had NULL holders.

bd_may_claim allows re-claims as long as the same holder is set.
I think we'll want to add an extra check that the holder_ops don't
change for this case. They aren't with the current holders, but this
is a place where a belt and suspenders might be a good idea..

>
> --D
>
> >
> > Thanks,
> > Ming
> >
---end quoted text---