Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3610779ybt; Tue, 30 Jun 2020 07:14:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuEc61iwlBrnTMLpTL3lbxKHr8JUmauZlEHcF2u1PaVy6Ei1Uk9KrYl4zgSeHUxifWlY+L X-Received: by 2002:a50:9f6a:: with SMTP id b97mr22671299edf.322.1593526456624; Tue, 30 Jun 2020 07:14:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593526456; cv=none; d=google.com; s=arc-20160816; b=lqzlYVFfpsK8ihYFACruzltperZNS8vJ5hnOKQMbQH3upOVmMpKzAJ4JBreNKdTYN6 Q+xf5B6Df4bga1vsZi6sDs2RkaAMZ3ENl2lzo/ymWrbas4fMoNvDlL0DsdNQRIyDrwyL Umyv0aWNMnYXpFsuVyEgDZMKlVanXWp7ggYPQ1yKgr6NaqwA5D7XbsJX1+dgBxmQvurf lCcCNpgqMVfB7vIHhikCsxbzobeUV/5scsLZSSK5u5ntRO86y05SlX1PAukOEA22xe41 nwHJvhI7T1Wa6YTRyZbLOsOdLPO6DgFmW4YkWmCrL7jdARTW8+P33NwcmREpzdO9dL0y 72Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2gzYJKUw1lB791sydbg4WdzI/JxJHx571I4CyirmXvM=; b=REiq8DUe588nNvSIHpEM55a1OtvD/brNeIXI2gDe9MRgx9R/RdFVQqZBAQy39fVw4Z vMgvrcPGVrCwFyB9034VcL+yzwF85MkSJfw9oNHBN8fVfaXpR3/IgX9oyUU0k1F+yNb2 exp8e1wSnVcmlFuF3el6CT7CJhnCcoW6mXlgO6Wu4oSv5uxQMiH1RB9e8pIMhoG5EKD9 E0c1W+P0qhyJZrRtDhUv3OVRUbdUnzKCrNXFfzJcYFz3xEQSXp99kUFTjcFlm9VYBvn7 SWxIiwa6o+Up5FkIjHvY0az9IUTi0POsekaC+JJb3T7b+tbnOAp2wCcgx32YvtdWwSfb TDng== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 92si1826442edj.9.2020.06.30.07.13.52; Tue, 30 Jun 2020 07:14: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388718AbgF3OK0 (ORCPT + 99 others); Tue, 30 Jun 2020 10:10:26 -0400 Received: from mx2.suse.de ([195.135.220.15]:40940 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731123AbgF3OKZ (ORCPT ); Tue, 30 Jun 2020 10:10:25 -0400 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 Cc: linux-nvdimm@lists.01.org, "Aneesh Kumar K.V" , Jan Kara , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com, Pankaj Gupta , "Michael S. Tsirkin" , Yuval Shaia , Cornelia Huck , Jakub Staron , linux-kernel@vger.kernel.org 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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