[dm-devel] [PATCH v7 2/3] block: add bdev_interposer
Mike Snitzer
snitzer at redhat.com
Wed Mar 17 14:58:22 UTC 2021
On Tue, Mar 16 2021 at 11:03pm -0400,
Ming Lei <ming.lei at redhat.com> wrote:
> On Tue, Mar 16, 2021 at 07:35:44PM +0300, Sergei Shtepa wrote:
> > The 03/16/2021 11:09, Ming Lei wrote:
> > > On Fri, Mar 12, 2021 at 06:44:54PM +0300, Sergei Shtepa wrote:
> > > > bdev_interposer allows to redirect bio requests to another devices.
> > > >
> > > > Signed-off-by: Sergei Shtepa <sergei.shtepa at veeam.com>
...
> > > > +
> > > > +int bdev_interposer_attach(struct block_device *original,
> > > > + struct block_device *interposer)
> > > > +{
> > > > + int ret = 0;
> > > > +
> > > > + if (WARN_ON(((!original) || (!interposer))))
> > > > + return -EINVAL;
> > > > + /*
> > > > + * interposer should be simple, no a multi-queue device
> > > > + */
> > > > + if (!interposer->bd_disk->fops->submit_bio)
> > > > + return -EINVAL;
> > > > +
> > > > + if (WARN_ON(!blk_mq_is_queue_frozen(original->bd_disk->queue)))
> > > > + return -EPERM;
> > >
> > > The original request queue may become live now...
> >
> > Yes.
> > I will remove the blk_mq_is_queue_frozen() function and use a different
> > approach.
>
> Looks what attach and detach needs is that queue is kept as frozen state
> instead of being froze simply at the beginning of the two functions, so
> you can simply call freeze/unfreeze inside the two functions.
>
> But what if 'original' isn't a MQ queue? queue usage counter is just
> grabed when calling ->submit_bio(), and queue freeze doesn't guarantee there
> isn't any io activity, is that a problem for bdev_interposer use case?
Right, I raised the same concern here:
https://listman.redhat.com/archives/dm-devel/2021-March/msg00135.html
(toward bottom inlined after dm_disk_{freeze,unfreeze}
Anyway, this certainly needs to be addressed.
Mike
More information about the dm-devel
mailing list