From: Dan Williams <dan.j.williams@intel.com> To: stable@vger.kernel.org Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>, hch@lst.de, linux-nvdimm@lists.01.org Subject: [5.4-stable PATCH 3/7] libnvdimm/pfn: Prevent raw mode fallback if pfn-infoblock valid Date: Thu, 21 May 2020 16:37:59 -0700 [thread overview] Message-ID: <159010427971.1062454.10990062889525749549.stgit@dwillia2-desk3.amr.corp.intel.com> (raw) In-Reply-To: <159010426294.1062454.8853083370975871627.stgit@dwillia2-desk3.amr.corp.intel.com> Commit b2ba7e91fa81bec9b64c47ab852145559cad2b68 upstream. The EOPNOTSUPP return code from the pmem driver indicates that the namespace has a configuration that may be valid, but the current kernel does not support it. Expand this to all of the nd_pfn_validate() error conditions after the infoblock has been verified as self consistent. This prevents exposing the namespace to I/O when the infoblock needs to be corrected, or the system needs to be put into a different configuration (like changing the page size on PowerPC). Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Cc: Jeff Moyer <jmoyer@redhat.com> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- drivers/nvdimm/pfn_devs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c index aa144c8a4ee6..8c5b13567f55 100644 --- a/drivers/nvdimm/pfn_devs.c +++ b/drivers/nvdimm/pfn_devs.c @@ -560,14 +560,14 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) dev_dbg(&nd_pfn->dev, "align: %lx:%lx mode: %d:%d\n", nd_pfn->align, align, nd_pfn->mode, mode); - return -EINVAL; + return -EOPNOTSUPP; } } if (align > nvdimm_namespace_capacity(ndns)) { dev_err(&nd_pfn->dev, "alignment: %lx exceeds capacity %llx\n", align, nvdimm_namespace_capacity(ndns)); - return -EINVAL; + return -EOPNOTSUPP; } /* @@ -580,7 +580,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) if (offset >= resource_size(&nsio->res)) { dev_err(&nd_pfn->dev, "pfn array size exceeds capacity of %s\n", dev_name(&ndns->dev)); - return -EBUSY; + return -EOPNOTSUPP; } if ((align && !IS_ALIGNED(nsio->res.start + offset + start_pad, align)) @@ -588,7 +588,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) dev_err(&nd_pfn->dev, "bad offset: %#llx dax disabled align: %#lx\n", offset, align); - return -ENXIO; + return -EOPNOTSUPP; } return nd_pfn_clear_memmap_errors(nd_pfn); _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
WARNING: multiple messages have this Message-ID (diff)
From: Dan Williams <dan.j.williams@intel.com> To: stable@vger.kernel.org Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>, Jeff Moyer <jmoyer@redhat.com>, "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>, vishal.l.verma@intel.com, hch@lst.de, linux-nvdimm@lists.01.org Subject: [5.4-stable PATCH 3/7] libnvdimm/pfn: Prevent raw mode fallback if pfn-infoblock valid Date: Thu, 21 May 2020 16:37:59 -0700 [thread overview] Message-ID: <159010427971.1062454.10990062889525749549.stgit@dwillia2-desk3.amr.corp.intel.com> (raw) In-Reply-To: <159010426294.1062454.8853083370975871627.stgit@dwillia2-desk3.amr.corp.intel.com> Commit b2ba7e91fa81bec9b64c47ab852145559cad2b68 upstream. The EOPNOTSUPP return code from the pmem driver indicates that the namespace has a configuration that may be valid, but the current kernel does not support it. Expand this to all of the nd_pfn_validate() error conditions after the infoblock has been verified as self consistent. This prevents exposing the namespace to I/O when the infoblock needs to be corrected, or the system needs to be put into a different configuration (like changing the page size on PowerPC). Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Cc: Jeff Moyer <jmoyer@redhat.com> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- drivers/nvdimm/pfn_devs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c index aa144c8a4ee6..8c5b13567f55 100644 --- a/drivers/nvdimm/pfn_devs.c +++ b/drivers/nvdimm/pfn_devs.c @@ -560,14 +560,14 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) dev_dbg(&nd_pfn->dev, "align: %lx:%lx mode: %d:%d\n", nd_pfn->align, align, nd_pfn->mode, mode); - return -EINVAL; + return -EOPNOTSUPP; } } if (align > nvdimm_namespace_capacity(ndns)) { dev_err(&nd_pfn->dev, "alignment: %lx exceeds capacity %llx\n", align, nvdimm_namespace_capacity(ndns)); - return -EINVAL; + return -EOPNOTSUPP; } /* @@ -580,7 +580,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) if (offset >= resource_size(&nsio->res)) { dev_err(&nd_pfn->dev, "pfn array size exceeds capacity of %s\n", dev_name(&ndns->dev)); - return -EBUSY; + return -EOPNOTSUPP; } if ((align && !IS_ALIGNED(nsio->res.start + offset + start_pad, align)) @@ -588,7 +588,7 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig) dev_err(&nd_pfn->dev, "bad offset: %#llx dax disabled align: %#lx\n", offset, align); - return -ENXIO; + return -EOPNOTSUPP; } return nd_pfn_clear_memmap_errors(nd_pfn);
next prev parent reply other threads:[~2020-05-21 23:54 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-21 23:37 [5.4-stable PATCH 0/7] libnvdimm: Cross-arch compatible namespace alignment Dan Williams 2020-05-21 23:37 ` Dan Williams 2020-05-21 23:37 ` [5.4-stable PATCH 1/7] mm/memremap_pages: Kill unused __devm_memremap_pages() Dan Williams 2020-05-21 23:37 ` Dan Williams 2020-05-21 23:37 ` [5.4-stable PATCH 2/7] mm/memremap_pages: Introduce memremap_compat_align() Dan Williams 2020-05-21 23:37 ` Dan Williams 2020-05-21 23:37 ` Dan Williams [this message] 2020-05-21 23:37 ` [5.4-stable PATCH 3/7] libnvdimm/pfn: Prevent raw mode fallback if pfn-infoblock valid Dan Williams 2020-05-21 23:38 ` [5.4-stable PATCH 4/7] libnvdimm/pfn_dev: Don't clear device memmap area during generic namespace probe Dan Williams 2020-05-21 23:38 ` Dan Williams 2020-05-21 23:38 ` [5.4-stable PATCH 5/7] libnvdimm/namespace: Enforce memremap_compat_align() Dan Williams 2020-05-21 23:38 ` Dan Williams 2020-05-21 23:38 ` [5.4-stable PATCH 6/7] libnvdimm/region: Introduce NDD_LABELING Dan Williams 2020-05-21 23:38 ` Dan Williams 2020-05-21 23:38 ` [5.4-stable PATCH 7/7] libnvdimm/region: Introduce an 'align' attribute Dan Williams 2020-05-21 23:38 ` Dan Williams 2020-05-22 11:58 ` [5.4-stable PATCH 0/7] libnvdimm: Cross-arch compatible namespace alignment Greg KH 2020-05-22 11:58 ` Greg KH 2020-05-22 12:00 ` Greg KH 2020-05-22 12:00 ` Greg KH 2020-05-26 20:42 ` Dan Williams 2020-05-26 20:42 ` Dan Williams 2020-05-26 20:49 ` Jeff Moyer 2020-05-26 20:49 ` Jeff Moyer 2020-05-26 20:52 ` Dan Williams 2020-05-26 20:52 ` Dan Williams 2020-06-01 11:07 ` Greg KH 2020-06-01 11:07 ` Greg KH
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=159010427971.1062454.10990062889525749549.stgit@dwillia2-desk3.amr.corp.intel.com \ --to=dan.j.williams@intel.com \ --cc=aneesh.kumar@linux.ibm.com \ --cc=hch@lst.de \ --cc=linux-nvdimm@lists.01.org \ --cc=stable@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.