f895984d71
bsc#1032074, fix Inconsistent metadata after upgrade OBS-URL: https://build.opensuse.org/request/show/491411 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/drbd-utils?expand=0&rev=38
73 lines
2.5 KiB
Diff
73 lines
2.5 KiB
Diff
detect_md() assumes that the metadata index format is
|
|
DRBD_MD_INDEX_FLEX_INT, but in fact it can also be
|
|
DRBD_MD_INDEX_FLEX_EXT.
|
|
|
|
[lge: Actually, it could even be old-style indexed fixed size meta data,
|
|
but that can be fixed an other day, or worked around with dump/restore.
|
|
|
|
Thanks for noticing and fixing a regression when trying to detect and
|
|
"convert" external meta data. We introduced said regression likely in
|
|
late 2011, even before 8.4 came out.]
|
|
|
|
Signed-off-by: Kristoffer Grönlund <krig@koru.se>
|
|
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
|
|
---
|
|
user/shared/drbdmeta.c | 12 ++++++------
|
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/user/shared/drbdmeta.c b/user/shared/drbdmeta.c
|
|
index 649076e1..2a79264c 100644
|
|
--- a/user/shared/drbdmeta.c
|
|
+++ b/user/shared/drbdmeta.c
|
|
@@ -4348,25 +4348,25 @@ void check_for_existing_data(struct format *cfg)
|
|
}
|
|
|
|
/* tries to guess what is in the on_disk_buffer */
|
|
-enum md_format detect_md(struct md_cpu *md, const uint64_t ll_size)
|
|
+enum md_format detect_md(struct md_cpu *md, const uint64_t ll_size, int index_format)
|
|
{
|
|
struct md_cpu md_test;
|
|
enum md_format have = DRBD_UNKNOWN;
|
|
|
|
md_disk_07_to_cpu(&md_test, (struct md_on_disk_07*)on_disk_buffer);
|
|
- if (is_valid_md(DRBD_V07, &md_test, DRBD_MD_INDEX_FLEX_INT, ll_size)) {
|
|
+ if (is_valid_md(DRBD_V07, &md_test, index_format, ll_size)) {
|
|
have = DRBD_V07;
|
|
*md = md_test;
|
|
}
|
|
|
|
md_disk_08_to_cpu(&md_test, (struct md_on_disk_08*)on_disk_buffer);
|
|
- if (is_valid_md(DRBD_V08, &md_test, DRBD_MD_INDEX_FLEX_INT, ll_size)) {
|
|
+ if (is_valid_md(DRBD_V08, &md_test, index_format, ll_size)) {
|
|
have = DRBD_V08;
|
|
*md = md_test;
|
|
}
|
|
|
|
md_disk_09_to_cpu(&md_test, (struct meta_data_on_disk_9*)on_disk_buffer);
|
|
- if (is_valid_md(DRBD_V09, &md_test, DRBD_MD_INDEX_FLEX_INT, ll_size)) {
|
|
+ if (is_valid_md(DRBD_V09, &md_test, index_format, ll_size)) {
|
|
have = DRBD_V09;
|
|
*md = md_test;
|
|
}
|
|
@@ -4406,7 +4406,7 @@ void check_internal_md_flavours(struct format * cfg) {
|
|
|
|
if (have == DRBD_UNKNOWN) {
|
|
PREAD(cfg, on_disk_buffer, 4096, flex_offset);
|
|
- have = detect_md(&md_now, cfg->bd_size);
|
|
+ have = detect_md(&md_now, cfg->bd_size, DRBD_MD_INDEX_FLEX_INT);
|
|
}
|
|
|
|
if (have == DRBD_UNKNOWN)
|
|
@@ -4515,7 +4515,7 @@ void check_external_md_flavours(struct format * cfg) {
|
|
}
|
|
|
|
PREAD(cfg, on_disk_buffer, 4096, cfg->md_offset);
|
|
- have = detect_md(&md_now, cfg->bd_size);
|
|
+ have = detect_md(&md_now, cfg->bd_size, DRBD_MD_INDEX_FLEX_EXT);
|
|
|
|
if (have == DRBD_UNKNOWN)
|
|
return;
|
|
--
|
|
2.12.0
|
|
|