Skip to content

Commit 7ba34c0

Browse files
committed
Merge tag 'libnvdimm-fixes-5.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm fixes from Dan Williams: "A couple of fixes for long standing bugs, a warning fixup, and some miscellaneous dax cleanups. The bugs were recently found due to new platforms looking to use the ACPI NFIT "virtual" device definition, and new error injection capabilities to trigger error responses to label area requests. Ira's cleanups have been long pending, I neglected to send them earlier, and see no harm in including them now. This has all appeared in -next with no reported issues. Summary: - Fix support for NFIT "virtual" ranges (BIOS-defined memory disks) - Fix recovery from failed label storage areas on NVDIMM devices - Miscellaneous cleanups from Ira's investigation of dax_direct_access paths preparing for stray-write protection" * tag 'libnvdimm-fixes-5.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: tools/testing/nvdimm: Fix missing 'fallthrough' warning libnvdimm/region: Fix label activation vs errors ACPI: NFIT: Fix support for virtual SPA ranges dax: Ensure errno is returned from dax_direct_access fs/dax: Clarify nr_pages to dax_direct_access() fs/fuse: Remove unneeded kaddr parameter
2 parents 12f4132 + 96dcb97 commit 7ba34c0

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed

drivers/acpi/nfit/core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,6 +3021,9 @@ static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc,
30213021
struct acpi_nfit_memory_map *memdev = nfit_memdev->memdev;
30223022
struct nd_mapping_desc *mapping;
30233023

3024+
/* range index 0 == unmapped in SPA or invalid-SPA */
3025+
if (memdev->range_index == 0 || spa->range_index == 0)
3026+
continue;
30243027
if (memdev->range_index != spa->range_index)
30253028
continue;
30263029
if (count >= ND_MAX_MAPPINGS) {

drivers/dax/super.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ long dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages,
313313
return -ENXIO;
314314

315315
if (nr_pages < 0)
316-
return nr_pages;
316+
return -EINVAL;
317317

318318
avail = dax_dev->ops->direct_access(dax_dev, pgoff, nr_pages,
319319
kaddr, pfn);

drivers/nvdimm/namespace_devs.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,7 +2527,7 @@ static void deactivate_labels(void *region)
25272527

25282528
static int init_active_labels(struct nd_region *nd_region)
25292529
{
2530-
int i;
2530+
int i, rc = 0;
25312531

25322532
for (i = 0; i < nd_region->ndr_mappings; i++) {
25332533
struct nd_mapping *nd_mapping = &nd_region->mapping[i];
@@ -2546,13 +2546,14 @@ static int init_active_labels(struct nd_region *nd_region)
25462546
else if (test_bit(NDD_LABELING, &nvdimm->flags))
25472547
/* fail, labels needed to disambiguate dpa */;
25482548
else
2549-
return 0;
2549+
continue;
25502550

25512551
dev_err(&nd_region->dev, "%s: is %s, failing probe\n",
25522552
dev_name(&nd_mapping->nvdimm->dev),
25532553
test_bit(NDD_LOCKED, &nvdimm->flags)
25542554
? "locked" : "disabled");
2555-
return -ENXIO;
2555+
rc = -ENXIO;
2556+
goto out;
25562557
}
25572558
nd_mapping->ndd = ndd;
25582559
atomic_inc(&nvdimm->busy);
@@ -2586,13 +2587,17 @@ static int init_active_labels(struct nd_region *nd_region)
25862587
break;
25872588
}
25882589

2589-
if (i < nd_region->ndr_mappings) {
2590+
if (i < nd_region->ndr_mappings)
2591+
rc = -ENOMEM;
2592+
2593+
out:
2594+
if (rc) {
25902595
deactivate_labels(nd_region);
2591-
return -ENOMEM;
2596+
return rc;
25922597
}
25932598

25942599
return devm_add_action_or_reset(&nd_region->dev, deactivate_labels,
2595-
nd_region);
2600+
nd_region);
25962601
}
25972602

25982603
int nd_region_register_namespaces(struct nd_region *nd_region, int *err)

fs/dax.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ static int copy_cow_page_dax(struct block_device *bdev, struct dax_device *dax_d
722722
return rc;
723723

724724
id = dax_read_lock();
725-
rc = dax_direct_access(dax_dev, pgoff, PHYS_PFN(PAGE_SIZE), &kaddr, NULL);
725+
rc = dax_direct_access(dax_dev, pgoff, 1, &kaddr, NULL);
726726
if (rc < 0) {
727727
dax_read_unlock(id);
728728
return rc;

fs/fuse/dax.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,8 +1235,6 @@ void fuse_dax_conn_free(struct fuse_conn *fc)
12351235
static int fuse_dax_mem_range_init(struct fuse_conn_dax *fcd)
12361236
{
12371237
long nr_pages, nr_ranges;
1238-
void *kaddr;
1239-
pfn_t pfn;
12401238
struct fuse_dax_mapping *range;
12411239
int ret, id;
12421240
size_t dax_size = -1;
@@ -1248,8 +1246,8 @@ static int fuse_dax_mem_range_init(struct fuse_conn_dax *fcd)
12481246
INIT_DELAYED_WORK(&fcd->free_work, fuse_dax_free_mem_worker);
12491247

12501248
id = dax_read_lock();
1251-
nr_pages = dax_direct_access(fcd->dev, 0, PHYS_PFN(dax_size), &kaddr,
1252-
&pfn);
1249+
nr_pages = dax_direct_access(fcd->dev, 0, PHYS_PFN(dax_size), NULL,
1250+
NULL);
12531251
dax_read_unlock(id);
12541252
if (nr_pages < 0) {
12551253
pr_debug("dax_direct_access() returned %ld\n", nr_pages);

tools/testing/nvdimm/test/nfit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ static int nd_intel_test_finish_query(struct nfit_test *t,
434434
dev_dbg(dev, "%s: transition out verify\n", __func__);
435435
fw->state = FW_STATE_UPDATED;
436436
fw->missed_activate = false;
437-
/* fall through */
437+
fallthrough;
438438
case FW_STATE_UPDATED:
439439
nd_cmd->status = 0;
440440
/* bogus test version */

0 commit comments

Comments
 (0)