Skip to content

Commit b2ba7e9

Browse files
committed
libnvdimm/pfn: Prevent raw mode fallback if pfn-infoblock valid
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 <[email protected]> Cc: Jeff Moyer <[email protected]> Reviewed-by: Aneesh Kumar K.V <[email protected]> Signed-off-by: Dan Williams <[email protected]>
1 parent 9ffc1d1 commit b2ba7e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/nvdimm/pfn_devs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,14 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
561561
dev_dbg(&nd_pfn->dev, "align: %lx:%lx mode: %d:%d\n",
562562
nd_pfn->align, align, nd_pfn->mode,
563563
mode);
564-
return -EINVAL;
564+
return -EOPNOTSUPP;
565565
}
566566
}
567567

568568
if (align > nvdimm_namespace_capacity(ndns)) {
569569
dev_err(&nd_pfn->dev, "alignment: %lx exceeds capacity %llx\n",
570570
align, nvdimm_namespace_capacity(ndns));
571-
return -EINVAL;
571+
return -EOPNOTSUPP;
572572
}
573573

574574
/*
@@ -581,15 +581,15 @@ int nd_pfn_validate(struct nd_pfn *nd_pfn, const char *sig)
581581
if (offset >= resource_size(&nsio->res)) {
582582
dev_err(&nd_pfn->dev, "pfn array size exceeds capacity of %s\n",
583583
dev_name(&ndns->dev));
584-
return -EBUSY;
584+
return -EOPNOTSUPP;
585585
}
586586

587587
if ((align && !IS_ALIGNED(nsio->res.start + offset + start_pad, align))
588588
|| !IS_ALIGNED(offset, PAGE_SIZE)) {
589589
dev_err(&nd_pfn->dev,
590590
"bad offset: %#llx dax disabled align: %#lx\n",
591591
offset, align);
592-
return -ENXIO;
592+
return -EOPNOTSUPP;
593593
}
594594

595595
return 0;

0 commit comments

Comments
 (0)