[DRBD-cvs] svn commit by phil - r2047 - in trunk: drbd user - * Two
fixes for the manual recovery after a split-brain
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Tue Jan 10 15:30:20 CET 2006
Author: phil
Date: 2006-01-10 15:30:17 +0100 (Tue, 10 Jan 2006)
New Revision: 2047
Modified:
trunk/drbd/drbd_main.c
trunk/drbd/drbd_receiver.c
trunk/user/drbdadm_main.c
Log:
* Two fixes for the manual recovery after a split-brain-situation
* drbdadm does now pass the "--discard-my-data" to drbdsetup.
* the "mdev->net_conf->want_lose" flags get honoured now.
* Various fixes to make detach/attach of the pimarie's disk possible.
* The secondary creates a new current-UUID in that case.
* The primary may go into Primary-SyncTarget state in that case
Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c 2006-01-09 22:06:29 UTC (rev 2046)
+++ trunk/drbd/drbd_main.c 2006-01-10 14:30:17 UTC (rev 2047)
@@ -773,7 +773,21 @@
/* Only do it if we have not yet done it... */
INFO("Creating new current UUID\n");
drbd_uuid_new_current(mdev);
+ drbd_md_write(mdev);
}
+ if (ns.peer == Primary ) {
+ /* Note: The condition ns.peer == Primary implies
+ that we are connected. Otherwise it would
+ be ns.peer == Unknown. */
+ /* Our peer lost its disk.
+ Not rotation into BitMap-UUID! A FullSync is
+ required after a primary detached from it disk! */
+ u64 uuid;
+ INFO("Creating new current UUID [no BitMap]\n");
+ get_random_bytes(&uuid, sizeof(u64));
+ drbd_uuid_set(mdev, Current, uuid);
+ drbd_md_write(mdev);
+ }
}
/* Removed disk, tell peer. */
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2006-01-09 22:06:29 UTC (rev 2046)
+++ trunk/drbd/drbd_receiver.c 2006-01-10 14:30:17 UTC (rev 2047)
@@ -1655,18 +1655,24 @@
} else {
hg = drbd_asb_recover_1p(mdev);
}
- if ( hg == -100 ) {
- if(mdev->net_conf->want_lose && !mdev->p_uuid[UUID_FLAGS]){
- hg = -1;
- }
- if(!mdev->net_conf->want_lose && mdev->p_uuid[UUID_FLAGS]){
- hg = 1;
- }
- } else {
+ if ( abs(hg) < 100 ) {
WARN("Split-Brain detected, automatically solved.\n");
}
}
+ if ( hg == -100 ) {
+ if(mdev->net_conf->want_lose && !mdev->p_uuid[UUID_FLAGS]) {
+ hg = -1;
+ }
+ if(!mdev->net_conf->want_lose && mdev->p_uuid[UUID_FLAGS]) {
+ hg = 1;
+ }
+
+ if ( abs(hg) < 100 ) {
+ WARN("Split-Brain detected, manually solved.\n");
+ }
+ }
+
if (hg == -1000) {
ALERT("Unrelated data, dropping connection!\n");
drbd_force_state(mdev,NS(conn,StandAlone));
@@ -1687,7 +1693,8 @@
drbd_thread_stop_nowait(&mdev->receiver);
return conn_mask;
}
- if (hg < 0 && mdev->state.role == Primary ) {
+ if (hg < 0 &&
+ mdev->state.role == Primary && mdev->state.disk != Attaching ) {
ERR("I shall become SyncTarget, but I am primary!\n");
drbd_force_state(mdev,NS(conn,StandAlone));
drbd_thread_stop_nowait(&mdev->receiver);
Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c 2006-01-09 22:06:29 UTC (rev 2046)
+++ trunk/user/drbdadm_main.c 2006-01-10 14:30:17 UTC (rev 2047)
@@ -719,7 +719,7 @@
{
char* argv[20];
struct d_option* opt;
-
+ int i;
int argc=0;
argv[argc++]=drbdsetup;
@@ -742,6 +742,11 @@
opt=res->net_options;
make_options(opt);
+
+ for(i=0;i<soi;i++) {
+ argv[argc++]=setup_opts[i];
+ }
+
argv[argc++]=0;
return m_system(argv,SLEEPS_SHORT);
More information about the drbd-cvs
mailing list