From 6ec689542b5bc516187917d49b112847dfb75b0b Mon Sep 17 00:00:00 2001 From: Vishal Verma Date: Wed, 29 Jul 2015 14:58:09 -0600 Subject: libnvdimm, btt: write and validate parent_uuid When a BTT is instantiated on a namespace it must validate the namespace uuid matches the 'parent_uuid' stored in the btt superblock. This property enforces that changing the namespace UUID invalidates all former BTT instances on that storage. For "IO namespaces" that don't have a label or UUID, the parent_uuid is set to zero, and this validation is skipped. For such cases, old BTTs have to be invalidated by forcing the namespace to raw mode, and overwriting the BTT info blocks. Based on a patch by Dan Williams Signed-off-by: Vishal Verma Signed-off-by: Dan Williams --- drivers/nvdimm/btt.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/nvdimm/btt.c') diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c index 6567746aa315..19588291550b 100644 --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c @@ -733,6 +733,7 @@ static int btt_arena_write_layout(struct arena_info *arena) int ret; struct btt_sb *super; struct nd_btt *nd_btt = arena->nd_btt; + const u8 *parent_uuid = nd_dev_to_uuid(&nd_btt->ndns->dev); ret = btt_map_init(arena); if (ret) @@ -748,6 +749,7 @@ static int btt_arena_write_layout(struct arena_info *arena) strncpy(super->signature, BTT_SIG, BTT_SIG_LEN); memcpy(super->uuid, nd_btt->uuid, 16); + memcpy(super->parent_uuid, parent_uuid, 16); super->flags = cpu_to_le32(arena->flags); super->version_major = cpu_to_le16(arena->version_major); super->version_minor = cpu_to_le16(arena->version_minor); -- cgit v1.2.3-70-g09d2