From: Toshi Kani <toshi.kani@hpe.com> To: dan.j.williams@intel.com Cc: vishal.l.verma@intel.com, micah.parrish@hpe.com, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, Toshi Kani <toshi.kani@hpe.com> Subject: [PATCH] BTT: Change nd_btt_arena_is_valid() to verify UUID Date: Thu, 17 Dec 2015 16:00:00 -0700 [thread overview] Message-ID: <1450393200-6802-1-git-send-email-toshi.kani@hpe.com> (raw) When user unbinds a BTT disk and binds again with a different sector size without wiping out the disk, a BTT disk is created with a wrong size. This is because the bind operation keeps the previous metadata, which leads nd_btt->lbasize inconsistent with internal_lbasize and external_lbasize in the arena. A reboot also reattaches the BTT from the previous metadata. Change nd_btt_arena_is_valid() to check if nd_btt->uuid matches with super->uuid when a new UUID is set for binding. This assures the bind operation writes the metadata with the values specified by user. Cc: Vishal Verma <vishal.l.verma@intel.com> Cc: Dan Williams <dan.j.williams@intel.com> Reported-by: Micah Parrish <micah.parrish@hpe.com> Signed-off-by: Toshi Kani <toshi.kani@hpe.com> --- drivers/nvdimm/btt_devs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c index cb47751..176ea25 100644 --- a/drivers/nvdimm/btt_devs.c +++ b/drivers/nvdimm/btt_devs.c @@ -218,6 +218,8 @@ static bool uuid_is_null(u8 *uuid) * Check consistency of the btt info block with itself by validating * the checksum, and with the parent namespace by verifying the * parent_uuid contained in the info block with the one supplied in. + * When nd_btt->uuid is set for binding, verify if the metadata is + * stale. * * Returns: * false for an invalid info block, true for a valid one @@ -234,6 +236,10 @@ bool nd_btt_arena_is_valid(struct nd_btt *nd_btt, struct btt_sb *super) if (memcmp(super->parent_uuid, parent_uuid, 16) != 0) return false; + if (nd_btt->uuid) + if (memcmp(super->uuid, nd_btt->uuid, 16) != 0) + return false; + checksum = le64_to_cpu(super->checksum); super->checksum = 0; if (checksum != nd_sb_checksum((struct nd_gen_sb *) super))
WARNING: multiple messages have this Message-ID (diff)
From: Toshi Kani <toshi.kani@hpe.com> To: dan.j.williams@intel.com Cc: vishal.l.verma@intel.com, micah.parrish@hpe.com, linux-nvdimm@ml01.01.org, linux-kernel@vger.kernel.org, Toshi Kani <toshi.kani@hpe.com> Subject: [PATCH] BTT: Change nd_btt_arena_is_valid() to verify UUID Date: Thu, 17 Dec 2015 16:00:00 -0700 [thread overview] Message-ID: <1450393200-6802-1-git-send-email-toshi.kani@hpe.com> (raw) When user unbinds a BTT disk and binds again with a different sector size without wiping out the disk, a BTT disk is created with a wrong size. This is because the bind operation keeps the previous metadata, which leads nd_btt->lbasize inconsistent with internal_lbasize and external_lbasize in the arena. A reboot also reattaches the BTT from the previous metadata. Change nd_btt_arena_is_valid() to check if nd_btt->uuid matches with super->uuid when a new UUID is set for binding. This assures the bind operation writes the metadata with the values specified by user. Cc: Vishal Verma <vishal.l.verma@intel.com> Cc: Dan Williams <dan.j.williams@intel.com> Reported-by: Micah Parrish <micah.parrish@hpe.com> Signed-off-by: Toshi Kani <toshi.kani@hpe.com> --- drivers/nvdimm/btt_devs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c index cb47751..176ea25 100644 --- a/drivers/nvdimm/btt_devs.c +++ b/drivers/nvdimm/btt_devs.c @@ -218,6 +218,8 @@ static bool uuid_is_null(u8 *uuid) * Check consistency of the btt info block with itself by validating * the checksum, and with the parent namespace by verifying the * parent_uuid contained in the info block with the one supplied in. + * When nd_btt->uuid is set for binding, verify if the metadata is + * stale. * * Returns: * false for an invalid info block, true for a valid one @@ -234,6 +236,10 @@ bool nd_btt_arena_is_valid(struct nd_btt *nd_btt, struct btt_sb *super) if (memcmp(super->parent_uuid, parent_uuid, 16) != 0) return false; + if (nd_btt->uuid) + if (memcmp(super->uuid, nd_btt->uuid, 16) != 0) + return false; + checksum = le64_to_cpu(super->checksum); super->checksum = 0; if (checksum != nd_sb_checksum((struct nd_gen_sb *) super))
next reply other threads:[~2015-12-17 23:00 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-12-17 23:00 Toshi Kani [this message] 2015-12-17 23:00 ` [PATCH] BTT: Change nd_btt_arena_is_valid() to verify UUID Toshi Kani 2015-12-18 8:34 ` Vishal Verma 2015-12-18 8:34 ` Vishal Verma 2015-12-18 15:15 ` Toshi Kani 2015-12-18 15:15 ` Toshi Kani 2015-12-18 17:54 ` Dan Williams 2015-12-18 17:54 ` Dan Williams 2015-12-18 18:52 ` Toshi Kani 2015-12-18 18:52 ` Toshi Kani 2015-12-18 22:23 ` Dan Williams 2015-12-18 22:23 ` Dan Williams 2016-01-12 15:02 ` Toshi Kani 2016-01-12 15:02 ` Toshi Kani 2016-01-12 16:38 ` Dan Williams 2016-01-12 16:38 ` Dan Williams 2016-01-12 16:47 ` Linda Knippers 2016-01-12 16:47 ` Linda Knippers 2016-01-12 16:51 ` Dan Williams 2016-01-12 16:51 ` Dan Williams
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1450393200-6802-1-git-send-email-toshi.kani@hpe.com \ --to=toshi.kani@hpe.com \ --cc=dan.j.williams@intel.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-nvdimm@lists.01.org \ --cc=micah.parrish@hpe.com \ --cc=vishal.l.verma@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.