diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-03-03 19:48:48 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-03-03 19:48:48 -0500 |
commit | 0b94da8dfc26ec2eb3e6640726e434abf8c53e49 (patch) | |
tree | 43bf09811495b0452a7a8714341ec6f36a91d6fa /drivers/nvdimm/namespace_devs.c | |
parent | e27fd02d92817845471a196b3020c5694cbe5ff3 (diff) | |
parent | 86ef58a4e35e8fa66afb5898cf6dec6a3bb29f67 (diff) |
Merge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm fixes from Dan Williams:
"A fix and regression test case for nvdimm namespace label
compatibility.
Details:
- An "nvdimm namespace label" is metadata on an nvdimm that
provisions dimm capacity into a "namespace" that can host a block
device / dax-filesytem, or a device-dax character device.
A namespace is an object that other operating environment and
platform firmware needs to comprehend for capabilities like booting
from an nvdimm.
The label metadata contains a checksum that Linux was not
calculating correctly leading to other environments rejecting the
Linux label.
These have received a build success notification from the kbuild
robot, and a positive test result from Nick who reported the problem"
* 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
nfit, libnvdimm: fix interleave set cookie calculation
tools/testing/nvdimm: make iset cookie predictable
Diffstat (limited to 'drivers/nvdimm/namespace_devs.c')
-rw-r--r-- | drivers/nvdimm/namespace_devs.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c index ce3e8dfa10ad..1b481a5fb966 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c | |||
@@ -1700,6 +1700,7 @@ static int select_pmem_id(struct nd_region *nd_region, u8 *pmem_id) | |||
1700 | struct device *create_namespace_pmem(struct nd_region *nd_region, | 1700 | struct device *create_namespace_pmem(struct nd_region *nd_region, |
1701 | struct nd_namespace_label *nd_label) | 1701 | struct nd_namespace_label *nd_label) |
1702 | { | 1702 | { |
1703 | u64 altcookie = nd_region_interleave_set_altcookie(nd_region); | ||
1703 | u64 cookie = nd_region_interleave_set_cookie(nd_region); | 1704 | u64 cookie = nd_region_interleave_set_cookie(nd_region); |
1704 | struct nd_label_ent *label_ent; | 1705 | struct nd_label_ent *label_ent; |
1705 | struct nd_namespace_pmem *nspm; | 1706 | struct nd_namespace_pmem *nspm; |
@@ -1718,7 +1719,11 @@ struct device *create_namespace_pmem(struct nd_region *nd_region, | |||
1718 | if (__le64_to_cpu(nd_label->isetcookie) != cookie) { | 1719 | if (__le64_to_cpu(nd_label->isetcookie) != cookie) { |
1719 | dev_dbg(&nd_region->dev, "invalid cookie in label: %pUb\n", | 1720 | dev_dbg(&nd_region->dev, "invalid cookie in label: %pUb\n", |
1720 | nd_label->uuid); | 1721 | nd_label->uuid); |
1721 | return ERR_PTR(-EAGAIN); | 1722 | if (__le64_to_cpu(nd_label->isetcookie) != altcookie) |
1723 | return ERR_PTR(-EAGAIN); | ||
1724 | |||
1725 | dev_dbg(&nd_region->dev, "valid altcookie in label: %pUb\n", | ||
1726 | nd_label->uuid); | ||
1722 | } | 1727 | } |
1723 | 1728 | ||
1724 | nspm = kzalloc(sizeof(*nspm), GFP_KERNEL); | 1729 | nspm = kzalloc(sizeof(*nspm), GFP_KERNEL); |
@@ -1733,9 +1738,14 @@ struct device *create_namespace_pmem(struct nd_region *nd_region, | |||
1733 | res->name = dev_name(&nd_region->dev); | 1738 | res->name = dev_name(&nd_region->dev); |
1734 | res->flags = IORESOURCE_MEM; | 1739 | res->flags = IORESOURCE_MEM; |
1735 | 1740 | ||
1736 | for (i = 0; i < nd_region->ndr_mappings; i++) | 1741 | for (i = 0; i < nd_region->ndr_mappings; i++) { |
1737 | if (!has_uuid_at_pos(nd_region, nd_label->uuid, cookie, i)) | 1742 | if (has_uuid_at_pos(nd_region, nd_label->uuid, cookie, i)) |
1738 | break; | 1743 | continue; |
1744 | if (has_uuid_at_pos(nd_region, nd_label->uuid, altcookie, i)) | ||
1745 | continue; | ||
1746 | break; | ||
1747 | } | ||
1748 | |||
1739 | if (i < nd_region->ndr_mappings) { | 1749 | if (i < nd_region->ndr_mappings) { |
1740 | struct nvdimm_drvdata *ndd = to_ndd(&nd_region->mapping[i]); | 1750 | struct nvdimm_drvdata *ndd = to_ndd(&nd_region->mapping[i]); |
1741 | 1751 | ||