Re: [PATCH 04/13] blkcg: introduce common blkg association logic
From: Dennis Zhou
Date: Mon Dec 03 2018 - 15:58:50 EST
Hi Christoph,
On Fri, Nov 30, 2018 at 01:52:09AM -0800, Christoph Hellwig wrote:
> > EXPORT_SYMBOL_GPL(bio_associate_blkcg);
> >
> > /**
> > - * bio_associate_blkg - associate a bio with the a blkg
> > + * bio_has_queue - required check for blkg association
> > + * @bio: target bio
> > + *
> > + * A blkg represents the relationship between a blkcg and a request_queue.
> > + * If there is no request_queue, there is no blkg and therefore nothing to
> > + * associate with.
> > + */
> > +static inline bool bio_has_queue(struct bio *bio)
> > +{
> > + return bio->bi_disk && bio->bi_disk->queue;
> > +}
>
> How do you ever see a bio without a queue? We can't even do I/O in
> that case.
The case I found was with the flush bio in dm which is statically
allocated in dm_alloc(). The issue issue is that bio_set_dev() is called
on a bdev that isn't opened. So, the bdev wasn't pointing to a genhd.
I've fixed the issue with the patch below, which will be added in v5.
I think I was being overly cautious with the change and have taken this
out in v5. It seems that this should be a one-off case which should work
with the patch below.
Thanks,
Dennis
---