Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp502614pxf; Wed, 17 Mar 2021 09:21:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfQ6ybnUKw63+u46US/duCyMR3UUt+Zv0LxXCr/FvuSH+akGGGJeORegtVd/funxAJsyCG X-Received: by 2002:a17:907:2661:: with SMTP id ci1mr35616435ejc.403.1615998076457; Wed, 17 Mar 2021 09:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615998076; cv=none; d=google.com; s=arc-20160816; b=rTSKEbzUlaFV+E8coePrDxhR3t9ZAJx5Ji0tX2REzepEWzFthWS3uDhqDaSJ1404PV VDzK7ynI62dTASgjErkGx//Yd1TNH77XScozb1TNOh26GFEnxLB26MqN+7CRKDYbDkWQ UmivPVxwu24Ju7jTxiS4E20Qa2E3xCHJvRIvyqmCxXsII9o54+++mFpLLX2n6YswNEtB KfSv4ZBIHhRBPpLo181qpL+JHvTIitXiyKAj/Obquc66/WdbkoHLfAxEuP4PtpgAsX1G Ey52al1Vrm2kquL9cmQb9i4N0qF7QkssULa/HaV8RfFEhnbMOb1kxrYfrPh6WuOCAxtl xiYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ELfQVFAUQ4JQADtBeiTRn2ychDmW2jmEhNf66mea9PA=; b=h674bUNDJWIps5jwXKnCyAKAuT1gPEecjtIikvTDxq+FYBeiHYc7c4hpSCrERAreiz Ms+Fn2dBuCYMdn1tEzOwFocpuT0Ut/960OYXRZ8KLRCEiiBWBJ83IuyWYzB0M9sJBbrN f6KC4XoPtNdWJ5FIHUPOTyIc3ceQvcRcfWPhJaj4jdBVirnpYn6qj5b1q8FFmyGkLG77 EV5Wo7GSFHWfLA1X+cTk5jWNBXtuCV/cu39zdYMbtyZAn8LwhWPlD4s3HQHjO5sMdS9w Q+eMkUdP4naZMPYWzWw7MrsjDLBb1twwYaJH/xc1XrkAKSF8O19hpHAVHFTQASxOcLNs U9cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NIfuzLxy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b9si16224596edr.611.2021.03.17.09.20.53; Wed, 17 Mar 2021 09:21:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NIfuzLxy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232533AbhCQQRV (ORCPT + 99 others); Wed, 17 Mar 2021 12:17:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:51703 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232560AbhCQQRI (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-kernel@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