Accepting request 491411 from home:wanghaisu:branches:network:ha-clustering:Factory

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
This commit is contained in:
nick wang 2017-04-27 06:33:43 +00:00 committed by Git OBS Bridge
parent e0361be973
commit f895984d71
3 changed files with 83 additions and 1 deletions

View File

@ -0,0 +1,72 @@
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

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Apr 27 06:19:24 UTC 2017 - nwang@suse.com
- bsc#1032074, fix Inconsistent metadata after upgrade
- Add Pass-md_index-information-to-detect_md.patch
* will be merged into upstream in v8.9.12
-------------------------------------------------------------------
Tue Apr 4 12:21:55 UTC 2017 - kgronlund@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package drbd-utils
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -34,6 +34,8 @@ Patch3: fence-after-pacemaker-down.patch
Patch4: fix-segfault-up-stacked-resource.patch
# PATCH-SUSE-FIX: Disable quorum in default configuration (bsc#1032142)
Patch5: 0001-Disable-quorum-in-default-configuration-bsc-1032142.patch
# Patch will be merged to upstream in 8.9.12 (bsc#1032074)
Patch6: Pass-md_index-information-to-detect_md.patch
Provides: drbd-bash-completion = %{version}
Provides: drbd-pacemaker = %{version}
@ -78,6 +80,7 @@ raid 1. It is a building block for setting up clusters.
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%build
./autogen.sh