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=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 84911C433DF for ; Tue, 30 Jun 2020 14:10:28 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2171E204EC for ; Tue, 30 Jun 2020 14:10:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2171E204EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E23E311427DB7; Tue, 30 Jun 2020 07:10:27 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=195.135.220.15; helo=mx2.suse.de; envelope-from=msuchanek@suse.de; receiver= Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 687A610FCD8FB for ; Tue, 30 Jun 2020 07:10:25 -0700 (PDT) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id DC17FB614; Tue, 30 Jun 2020 14:10:23 +0000 (UTC) Date: Tue, 30 Jun 2020 16:10:22 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Mikulas Patocka Subject: Re: [PATCH] dm writecache: reject asynchronous pmem. Message-ID: <20200630141022.GZ21462@kitsune.suse.cz> References: <20200630123528.29660-1-msuchanek@suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Message-ID-Hash: 235P3RYLQ6Z2TOGT22P5GADA6U34QKLH X-Message-ID-Hash: 235P3RYLQ6Z2TOGT22P5GADA6U34QKLH X-MailFrom: msuchanek@suse.de X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation CC: linux-nvdimm@lists.01.org, "Aneesh Kumar K.V" , Jan Kara , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, "Michael S. Tsirkin" , Yuval Shaia , Cornelia Huck , Jakub Staron , linux-kernel@vger.kernel.org X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Tue, Jun 30, 2020 at 09:32:01AM -0400, Mikulas Patocka wrote: > > > On Tue, 30 Jun 2020, Michal Suchanek wrote: > > > The writecache driver does not handle asynchronous pmem. Reject it when > > supplied as cache. > > > > Link: https://lore.kernel.org/linux-nvdimm/87lfk5hahc.fsf@linux.ibm.com/ > > Fixes: 6e84200c0a29 ("virtio-pmem: Add virtio pmem driver") > > > > Signed-off-by: Michal Suchanek > > --- > > drivers/md/dm-writecache.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c > > index 30505d70f423..57b0a972f6fd 100644 > > --- a/drivers/md/dm-writecache.c > > +++ b/drivers/md/dm-writecache.c > > @@ -2277,6 +2277,12 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) > > > > wc->memory_map_size -= (uint64_t)wc->start_sector << SECTOR_SHIFT; > > > > + if (!dax_synchronous(wc->ssd_dev->dax_dev)) { > > + r = -EOPNOTSUPP; > > + ti->error = "Asynchronous persistent memory not supported as pmem cache"; > > + goto bad; > > + } > > + > > bio_list_init(&wc->flush_list); > > wc->flush_thread = kthread_create(writecache_flush_thread, wc, "dm_writecache_flush"); > > if (IS_ERR(wc->flush_thread)) { > > -- > > Hi > > Shouldn't this be in the "if (WC_MODE_PMEM(wc))" block? That should be always the case at this point. > > WC_MODE_PMEM(wc) retrurns true if we are using persistent memory as a > cache device, otherwise we are using generic block device as a cache > device. This is to prevent the situation where we have WC_MODE_PMEM(wc) but cannot guarantee consistency because the async flush is not handled. Thanks Michal _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org