From: Mike Snitzer <snitzer@redhat.com> To: Ming Lei <ming.lei@redhat.com> Cc: Sergei Shtepa <sergei.shtepa@veeam.com>, Christoph Hellwig <hch@infradead.org>, Alasdair Kergon <agk@redhat.com>, Hannes Reinecke <hare@suse.de>, Jens Axboe <axboe@kernel.dk>, "dm-devel@redhat.com" <dm-devel@redhat.com>, "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "linux-api@vger.kernel.org" <linux-api@vger.kernel.org>, Pavel Tide <Pavel.TIde@veeam.com> Subject: Re: [PATCH v7 2/3] block: add bdev_interposer Date: Wed, 17 Mar 2021 10:58:22 -0400 [thread overview] Message-ID: <20210317145822.GA29481@redhat.com> (raw) In-Reply-To: <YFFxdz84esfiTvNk@T590> On Tue, Mar 16 2021 at 11:03pm -0400, Ming Lei <ming.lei@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@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
WARNING: multiple messages have this Message-ID (diff)
From: Mike Snitzer <snitzer@redhat.com> To: Ming Lei <ming.lei@redhat.com> Cc: Jens Axboe <axboe@kernel.dk>, "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>, "linux-api@vger.kernel.org" <linux-api@vger.kernel.org>, Pavel Tide <Pavel.TIde@veeam.com>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Christoph Hellwig <hch@infradead.org>, "dm-devel@redhat.com" <dm-devel@redhat.com>, Sergei Shtepa <sergei.shtepa@veeam.com>, Alasdair Kergon <agk@redhat.com> Subject: Re: [dm-devel] [PATCH v7 2/3] block: add bdev_interposer Date: Wed, 17 Mar 2021 10:58:22 -0400 [thread overview] Message-ID: <20210317145822.GA29481@redhat.com> (raw) In-Reply-To: <YFFxdz84esfiTvNk@T590> On Tue, Mar 16 2021 at 11:03pm -0400, Ming Lei <ming.lei@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@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 -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2021-03-17 16:17 UTC|newest] Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-12 15:44 [PATCH v7 0/3] block device interposer Sergei Shtepa 2021-03-12 15:44 ` [dm-devel] " Sergei Shtepa 2021-03-12 15:44 ` [PATCH v7 1/3] block: add blk_mq_is_queue_frozen() Sergei Shtepa 2021-03-12 15:44 ` [dm-devel] " Sergei Shtepa 2021-03-12 19:06 ` Mike Snitzer 2021-03-12 19:06 ` [dm-devel] " Mike Snitzer 2021-03-14 9:14 ` Christoph Hellwig 2021-03-14 9:14 ` [dm-devel] " Christoph Hellwig 2021-03-15 12:06 ` Sergei Shtepa 2021-03-15 12:06 ` [dm-devel] " Sergei Shtepa 2021-03-12 15:44 ` [PATCH v7 2/3] block: add bdev_interposer Sergei Shtepa 2021-03-12 15:44 ` [dm-devel] " Sergei Shtepa 2021-03-14 9:28 ` Christoph Hellwig 2021-03-14 9:28 ` [dm-devel] " Christoph Hellwig 2021-03-15 13:06 ` Sergei Shtepa 2021-03-15 13:06 ` [dm-devel] " Sergei Shtepa 2021-03-16 8:09 ` Ming Lei 2021-03-16 8:09 ` [dm-devel] " Ming Lei 2021-03-16 16:35 ` Sergei Shtepa 2021-03-16 16:35 ` [dm-devel] " Sergei Shtepa 2021-03-17 3:03 ` Ming Lei 2021-03-17 3:03 ` [dm-devel] " Ming Lei 2021-03-17 12:22 ` Sergei Shtepa 2021-03-17 12:22 ` [dm-devel] " Sergei Shtepa 2021-03-17 15:04 ` Mike Snitzer 2021-03-17 15:04 ` [dm-devel] " Mike Snitzer 2021-03-17 18:14 ` Sergei Shtepa 2021-03-17 18:14 ` [dm-devel] " Sergei Shtepa 2021-03-17 19:13 ` Mike Snitzer 2021-03-17 19:13 ` [dm-devel] " Mike Snitzer 2021-03-18 14:56 ` Sergei Shtepa 2021-03-18 14:56 ` [dm-devel] " Sergei Shtepa 2021-03-17 14:58 ` Mike Snitzer [this message] 2021-03-17 14:58 ` Mike Snitzer 2021-03-12 15:44 ` [PATCH v7 3/3] dm: add DM_INTERPOSED_FLAG Sergei Shtepa 2021-03-12 15:44 ` [dm-devel] " Sergei Shtepa 2021-03-12 19:00 ` Mike Snitzer 2021-03-12 19:00 ` [dm-devel] " Mike Snitzer 2021-03-15 12:29 ` Sergei Shtepa 2021-03-15 12:29 ` [dm-devel] " Sergei Shtepa 2021-03-14 9:30 ` Christoph Hellwig 2021-03-14 9:30 ` [dm-devel] " Christoph Hellwig 2021-03-15 13:25 ` Sergei Shtepa 2021-03-15 13:25 ` [dm-devel] " Sergei Shtepa 2021-03-16 15:23 ` Christoph Hellwig 2021-03-16 15:23 ` [dm-devel] " Christoph Hellwig 2021-03-16 15:25 ` Christoph Hellwig 2021-03-16 15:25 ` [dm-devel] " Christoph Hellwig 2021-03-16 16:20 ` Sergei Shtepa 2021-03-16 16:20 ` [dm-devel] " Sergei Shtepa
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210317145822.GA29481@redhat.com \ --to=snitzer@redhat.com \ --cc=Pavel.TIde@veeam.com \ --cc=agk@redhat.com \ --cc=axboe@kernel.dk \ --cc=dm-devel@redhat.com \ --cc=hare@suse.de \ --cc=hch@infradead.org \ --cc=linux-api@vger.kernel.org \ --cc=linux-block@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=ming.lei@redhat.com \ --cc=sergei.shtepa@veeam.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.