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=-11.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 32E32C43461 for ; Wed, 16 Sep 2020 15:22:18 +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 6BEFF22453 for ; Wed, 16 Sep 2020 15:22:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IOdVATpa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BEFF22453 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com 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 C1E7214518B2E; Wed, 16 Sep 2020 08:22:16 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=63.128.21.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=msnitzer@redhat.com; receiver= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2F60214518B2C for ; Wed, 16 Sep 2020 08:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600269731; 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=cjF2GTwA7gL/I5MK7tLcOog/hAPgLrIkOT7IjuYm6qc=; b=IOdVATpa3VhZUzDoVOzj0VDK53uTLDeo7JkC4oBlifPAWua6wRiSv7KMv6u73sgy/+/UAb 6g7h32KIG9VNvK54xYvYtrmmf42BbHjY4guXJLBjBHb1KciHUG8bw0CwuLB833md2p5MXQ YGXictn1FqZg3befLMRXK7DM0T/7GwY= 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-44-eYS53MYtPuGnamtd7H2f7w-1; Wed, 16 Sep 2020 11:22:07 -0400 X-MC-Unique: eYS53MYtPuGnamtd7H2f7w-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 302BB186DD2A; Wed, 16 Sep 2020 15:22:06 +0000 (UTC) Received: from localhost (unknown [10.18.25.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB4B51002D60; Wed, 16 Sep 2020 15:22:05 +0000 (UTC) Date: Wed, 16 Sep 2020 11:22:05 -0400 From: Mike Snitzer To: Jan Kara , Dan Williams Subject: Re: dm: Call proper helper to determine dax support Message-ID: <20200916152204.GA29829@redhat.com> References: <20200916151445.450-1-jack@suse.cz> MIME-Version: 1.0 In-Reply-To: <20200916151445.450-1-jack@suse.cz> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=msnitzer@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Message-ID-Hash: PL6WJ3U2VTVVD7HOANRMQZNZX2GDJCOF X-Message-ID-Hash: PL6WJ3U2VTVVD7HOANRMQZNZX2GDJCOF X-MailFrom: msnitzer@redhat.com 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, Adrian Huang , Coly Li , Mikulas Patocka , Alasdair Kergon 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 Wed, Sep 16 2020 at 11:14am -0400, Jan Kara wrote: > DM was calling generic_fsdax_supported() to determine whether a device > referenced in the DM table supports DAX. However this is a helper for "leaf" device drivers so that > they don't have to duplicate common generic checks. High level code > should call dax_supported() helper which that calls into appropriate > helper for the particular device. This problem manifested itself as > kernel messages: > > dm-3: error: dax access failed (-95) > > when lvm2-testsuite run in cases where a DM device was stacked on top of > another DM device. > > Fixes: 7bf7eac8d648 ("dax: Arrange for dax_supported check to span multiple devices") > Tested-by: Adrian Huang > Signed-off-by: Jan Kara Looked good: Acked-by: Mike Snitzer This fix should Cc stable@ right? > --- > drivers/dax/super.c | 4 ++++ > drivers/md/dm-table.c | 3 +-- > include/linux/dax.h | 11 +++++++++-- > 3 files changed, 14 insertions(+), 4 deletions(-) > > This patch should go in together with Adrian's > https://lore.kernel.org/linux-nvdimm/20200916133923.31-1-adrianhuang0701@gmail.com Sure, but there really isn't a dependency right? Dan, will you be picking these up to send to Linux for 5.9-rc? Thanks, Mike > > diff --git a/drivers/dax/super.c b/drivers/dax/super.c > index e5767c83ea23..b6284c5cae0a 100644 > --- a/drivers/dax/super.c > +++ b/drivers/dax/super.c > @@ -325,11 +325,15 @@ EXPORT_SYMBOL_GPL(dax_direct_access); > bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev, > int blocksize, sector_t start, sector_t len) > { > + if (!dax_dev) > + return false; > + > if (!dax_alive(dax_dev)) > return false; > > return dax_dev->ops->dax_supported(dax_dev, bdev, blocksize, start, len); > } > +EXPORT_SYMBOL_GPL(dax_supported); > > size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, > size_t bytes, struct iov_iter *i) > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > index 5edc3079e7c1..bed1ff0744ec 100644 > --- a/drivers/md/dm-table.c > +++ b/drivers/md/dm-table.c > @@ -862,8 +862,7 @@ int device_supports_dax(struct dm_target *ti, struct dm_dev *dev, > { > int blocksize = *(int *) data; > > - return generic_fsdax_supported(dev->dax_dev, dev->bdev, blocksize, > - start, len); > + return dax_supported(dev->dax_dev, dev->bdev, blocksize, start, len); > } > > /* Check devices support synchronous DAX */ > diff --git a/include/linux/dax.h b/include/linux/dax.h > index 6904d4e0b2e0..9f916326814a 100644 > --- a/include/linux/dax.h > +++ b/include/linux/dax.h > @@ -130,6 +130,8 @@ static inline bool generic_fsdax_supported(struct dax_device *dax_dev, > return __generic_fsdax_supported(dax_dev, bdev, blocksize, start, > sectors); > } > +bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev, > + int blocksize, sector_t start, sector_t len); > > static inline void fs_put_dax(struct dax_device *dax_dev) > { > @@ -157,6 +159,13 @@ static inline bool generic_fsdax_supported(struct dax_device *dax_dev, > return false; > } > > +static inline bool dax_supported(struct dax_device *dax_dev, > + struct block_device *bdev, int blocksize, sector_t start, > + sector_t len) > +{ > + return false; > +} > + > static inline void fs_put_dax(struct dax_device *dax_dev) > { > } > @@ -195,8 +204,6 @@ bool dax_alive(struct dax_device *dax_dev); > void *dax_get_private(struct dax_device *dax_dev); > long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages, > void **kaddr, pfn_t *pfn); > -bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev, > - int blocksize, sector_t start, sector_t len); > size_t dax_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, > size_t bytes, struct iov_iter *i); > size_t dax_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, void *addr, > -- > 2.16.4 > _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org