From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 318AAC433E0 for ; Wed, 17 Mar 2021 16:17:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD64564F45 for ; Wed, 17 Mar 2021 16:17:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232537AbhCQQRV (ORCPT ); Wed, 17 Mar 2021 12:17:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:30450 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232559AbhCQQRI (ORCPT ); Wed, 17 Mar 2021 12:17:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615997827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ELfQVFAUQ4JQADtBeiTRn2ychDmW2jmEhNf66mea9PA=; b=NIfuzLxyCmm0qE+6IjSiqH0en3A3G0yl2H/e8dV03DhiB0o+xODrwGe/weTw77b2PizihS AIhSE6i4Jt1rxnfW1sX/waQ7eQOWlagO8PdUATj6gPohuPELKeLV4VFYKwPIGpI7SP4uqi DCw27YA73ZwdcwBUgenC4DiSCSNhlJQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-543-eaSNbJBEPKuT39uC2itS5Q-1; Wed, 17 Mar 2021 10:58:31 -0400 X-MC-Unique: eaSNbJBEPKuT39uC2itS5Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 97D481926DA1; Wed, 17 Mar 2021 14:58:29 +0000 (UTC) Received: from localhost (unknown [10.18.25.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5371737DD; Wed, 17 Mar 2021 14:58:23 +0000 (UTC) Date: Wed, 17 Mar 2021 10:58:22 -0400 From: Mike Snitzer To: Ming Lei Cc: Sergei Shtepa , Christoph Hellwig , Alasdair Kergon , Hannes Reinecke , Jens Axboe , "dm-devel@redhat.com" , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , Pavel Tide Subject: Re: [PATCH v7 2/3] block: add bdev_interposer Message-ID: <20210317145822.GA29481@redhat.com> References: <1615563895-28565-1-git-send-email-sergei.shtepa@veeam.com> <1615563895-28565-3-git-send-email-sergei.shtepa@veeam.com> <20210316163544.GA31272@veeam.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Tue, Mar 16 2021 at 11:03pm -0400, Ming Lei 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 ... > > > > + > > > > +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