diff --git a/drbd.changes b/drbd.changes index bb9e981..643927e 100644 --- a/drbd.changes +++ b/drbd.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Jan 10 02:16:03 UTC 2019 - nwang@suse.com + +- bsc#1118732, split brain handles malfunction when 2 primaries. +- Add patch rely-on-sb-handlers.patch + ------------------------------------------------------------------- Mon Dec 10 08:06:53 UTC 2018 - nwang@suse.com diff --git a/drbd.spec b/drbd.spec index c7bb33c..146401f 100644 --- a/drbd.spec +++ b/drbd.spec @@ -37,6 +37,7 @@ Source2: Module.supported Source3: drbd_git_revision Patch1: fix-resync-finished-with-syncs-have-bits-set.patch Patch2: compat_no_bioset_initialized.patch +Patch3: rely-on-sb-handlers.patch BuildRequires: kernel-source BuildRequires: kernel-syms BuildRequires: libelf-devel @@ -71,6 +72,7 @@ installed kernel. %setup -q -n drbd-%{version} %patch1 -p1 %patch2 -p1 +%patch3 -p1 mkdir source cp -a drbd/. source/. || : diff --git a/rely-on-sb-handlers.patch b/rely-on-sb-handlers.patch new file mode 100644 index 0000000..247fb76 --- /dev/null +++ b/rely-on-sb-handlers.patch @@ -0,0 +1,96 @@ +diff -Naur drbd-9.0.15+git.c46d2790.orig/drbd/drbd_state.c drbd-9.0.15+git.c46d2790/drbd/drbd_state.c +--- drbd-9.0.15+git.c46d2790.orig/drbd/drbd_state.c 2019-01-10 13:10:28.152414247 +0800 ++++ drbd-9.0.15+git.c46d2790/drbd/drbd_state.c 2019-01-10 13:10:38.140407675 +0800 +@@ -251,6 +251,27 @@ + return rv; + } + ++static bool is_sb_handlers_configured(struct drbd_connection *connection) ++{ ++ bool configured = false; ++ ++ enum drbd_after_sb_p after_sb_0p = -1; ++ enum drbd_after_sb_p after_sb_1p = -1; ++ enum drbd_after_sb_p after_sb_2p = -1; ++ ++ after_sb_0p = rcu_dereference(connection->transport.net_conf)->after_sb_0p; ++ after_sb_1p = rcu_dereference(connection->transport.net_conf)->after_sb_1p; ++ after_sb_2p = rcu_dereference(connection->transport.net_conf)->after_sb_2p; ++ ++ if (after_sb_2p != 0 || after_sb_0p != 0 || after_sb_1p != 0) { ++ drbd_info(connection, "Split-brain handler configured, rely on it.\n"); ++ configured = true; ++ } ++ ++ return configured; ++} ++ ++ + bool resource_is_suspended(struct drbd_resource *resource, enum which_state which) + { + bool rv = resource->susp_user[which] || resource->susp_nod[which]; +@@ -1465,7 +1486,8 @@ + if (!nc || nc->two_primaries) + continue; + if (connection->peer_role[NEW] == R_PRIMARY) +- return SS_TWO_PRIMARIES; ++ if (!is_sb_handlers_configured(connection)) ++ return SS_TWO_PRIMARIES; + } + } + +@@ -1500,10 +1522,10 @@ + nc = rcu_dereference(connection->transport.net_conf); + two_primaries = nc ? nc->two_primaries : false; + if (peer_role[NEW] == R_PRIMARY && peer_role[OLD] != R_PRIMARY && !two_primaries) { +- if (role[NOW] == R_PRIMARY) ++ if (role[NOW] == R_PRIMARY && !is_sb_handlers_configured(connection)) + return SS_TWO_PRIMARIES; + idr_for_each_entry(&resource->devices, device, vnr) { +- if (device->open_ro_cnt) ++ if (device->open_ro_cnt && !is_sb_handlers_configured(connection)) + return SS_PRIMARY_READER; + } + } +@@ -3785,8 +3807,10 @@ + mask = NODE_MASK(connection->peer_node_id); + if ((resource->twopc_reply.primary_nodes & mask) && + !(connection->transport.net_conf->two_primaries)) { +- rv = SS_TWO_PRIMARIES; +- break; ++ if (!is_sb_handlers_configured(connection)){ ++ rv = SS_TWO_PRIMARIES; ++ break; ++ } + } + } + rcu_read_unlock(); +@@ -3829,10 +3853,13 @@ + rcu_read_lock(); + nc = rcu_dereference(connection->transport.net_conf); + two_primaries = nc ? nc->two_primaries : false; +- rcu_read_unlock(); + +- if (!two_primaries) ++ if (!two_primaries && !is_sb_handlers_configured(connection)) { ++ rcu_read_unlock(); + return SS_TWO_PRIMARIES; ++ } ++ ++ rcu_read_unlock(); + } + + return SS_SUCCESS; +@@ -3859,8 +3886,10 @@ + nc = rcu_dereference(connection->transport.net_conf); + if (!nc->two_primaries && + NODE_MASK(connection->peer_node_id) & reply->primary_nodes) { +- rv = SS_PRIMARY_READER; +- break; ++ if (!is_sb_handlers_configured(connection)){ ++ rv = SS_PRIMARY_READER; ++ break; ++ } + } + } + rcu_read_unlock();