diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-25 18:13:10 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-25 18:13:10 -0700 |
commit | 828bf6e904eb8fc8969333568802689fbbf07a40 (patch) | |
tree | 669784db5c100f75698f2a4511d31047dd0b3d50 /drivers/nvdimm/dimm.c | |
parent | b326272010b6656210193d7ab93fa184087e8ee1 (diff) | |
parent | 286e87718103acdf85f4ed323a37e4839a8a7c05 (diff) | |
download | linux-828bf6e904eb8fc8969333568802689fbbf07a40.tar.gz linux-828bf6e904eb8fc8969333568802689fbbf07a40.tar.bz2 linux-828bf6e904eb8fc8969333568802689fbbf07a40.zip |
Merge tag 'libnvdimm-for-4.19_misc' of gitolite.kernel.org:pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm updates from Dave Jiang:
"Collection of misc libnvdimm patches for 4.19 submission:
- Adding support to read locked nvdimm capacity.
- Change test code to make DSM failure code injection an override.
- Add support for calculate maximum contiguous area for namespace.
- Add support for queueing a short ARS when there is on going ARS for
nvdimm.
- Allow NULL to be passed in to ->direct_access() for kaddr and pfn
params.
- Improve smart injection support for nvdimm emulation testing.
- Fix test code that supports for emulating controller temperature.
- Fix hang on error before devm_memremap_pages()
- Fix a bug that causes user memory corruption when data returned to
user for ars_status.
- Maintainer updates for Ross Zwisler emails and adding Jan Kara to
fsdax"
* tag 'libnvdimm-for-4.19_misc' of gitolite.kernel.org:pub/scm/linux/kernel/git/nvdimm/nvdimm:
libnvdimm: fix ars_status output length calculation
device-dax: avoid hang on error before devm_memremap_pages()
tools/testing/nvdimm: improve emulation of smart injection
filesystem-dax: Do not request kaddr and pfn when not required
md/dm-writecache: Don't request pointer dummy_addr when not required
dax/super: Do not request a pointer kaddr when not required
tools/testing/nvdimm: kaddr and pfn can be NULL to ->direct_access()
s390, dcssblk: kaddr and pfn can be NULL to ->direct_access()
libnvdimm, pmem: kaddr and pfn can be NULL to ->direct_access()
acpi/nfit: queue issuing of ars when an uc error notification comes in
libnvdimm: Export max available extent
libnvdimm: Use max contiguous area for namespace size
MAINTAINERS: Add Jan Kara for filesystem DAX
MAINTAINERS: update Ross Zwisler's email address
tools/testing/nvdimm: Fix support for emulating controller temperature
tools/testing/nvdimm: Make DSM failure code injection an override
acpi, nfit: Prefer _DSM over _LSR for namespace label reads
libnvdimm: Introduce locked DIMM capacity support
Diffstat (limited to 'drivers/nvdimm/dimm.c')
-rw-r--r-- | drivers/nvdimm/dimm.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/nvdimm/dimm.c b/drivers/nvdimm/dimm.c index 233907889f96..6c8fb7590838 100644 --- a/drivers/nvdimm/dimm.c +++ b/drivers/nvdimm/dimm.c @@ -34,6 +34,9 @@ static int nvdimm_probe(struct device *dev) return rc; } + /* reset locked, to be validated below... */ + nvdimm_clear_locked(dev); + ndd = kzalloc(sizeof(*ndd), GFP_KERNEL); if (!ndd) return -ENOMEM; @@ -48,12 +51,30 @@ static int nvdimm_probe(struct device *dev) get_device(dev); kref_init(&ndd->kref); + /* + * EACCES failures reading the namespace label-area-properties + * are interpreted as the DIMM capacity being locked but the + * namespace labels themselves being accessible. + */ rc = nvdimm_init_nsarea(ndd); - if (rc == -EACCES) + if (rc == -EACCES) { + /* + * See nvdimm_namespace_common_probe() where we fail to + * allow namespaces to probe while the DIMM is locked, + * but we do allow for namespace enumeration. + */ nvdimm_set_locked(dev); + rc = 0; + } if (rc) goto err; + /* + * EACCES failures reading the namespace label-data are + * interpreted as the label area being locked in addition to the + * DIMM capacity. We fail the dimm probe to prevent regions from + * attempting to parse the label area. + */ rc = nvdimm_init_config_data(ndd); if (rc == -EACCES) nvdimm_set_locked(dev); @@ -72,7 +93,6 @@ static int nvdimm_probe(struct device *dev) if (rc == 0) nvdimm_set_aliasing(dev); } - nvdimm_clear_locked(dev); nvdimm_bus_unlock(dev); if (rc) |