[DRBD-cvs] svn commit by phil - r3043 - in branches/drbd-8.0/drbd:
. linux - When you let DRBD connect to an listening TCP port and
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Fri Aug 31 23:24:41 CEST 2007
Author: phil
Date: 2007-08-31 23:24:39 +0200 (Fri, 31 Aug 2007)
New Revision: 3043
Modified:
branches/drbd-8.0/drbd/drbd_main.c
branches/drbd-8.0/drbd/drbd_receiver.c
branches/drbd-8.0/drbd/drbd_strings.c
branches/drbd-8.0/drbd/linux/drbd.h
Log:
When you let DRBD connect to an listening TCP port and close
that, then allowing it to connect a second time you trigger
an workaround from the DRBD-0.7 days. It is printed to the
syslog as "My msock connect got accepted onto peer's sock!".
The the receiver sleeps for connect_int/2.
When you droped the network config during this time with
"drbdadm disconnect", you hit an OOPS.
The root of this bug was the the
if(drbd_request_state(mdev,NS(conn,WFConnection)) < SS_Success ) ...
statement in drbd_connect() elevated the connection state from
StandAlone to WFConnection. Later we dereference mdev->net_conf
and OOPS...
I fixed this by allowing that state change only when the connection
state before was >= Unconnected (I.e. we had a network config).
Modified: branches/drbd-8.0/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0/drbd/drbd_main.c 2007-08-31 12:33:54 UTC (rev 3042)
+++ branches/drbd-8.0/drbd/drbd_main.c 2007-08-31 21:24:39 UTC (rev 3043)
@@ -595,6 +595,9 @@
if( ns.disk > Attaching && os.disk == Diskless)
rv=SS_IsDiskLess;
+ if ( ns.conn == WFConnection && os.conn < Unconnected )
+ rv=SS_NoNetConfig;
+
return rv;
}
Modified: branches/drbd-8.0/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0/drbd/drbd_receiver.c 2007-08-31 12:33:54 UTC (rev 3042)
+++ branches/drbd-8.0/drbd/drbd_receiver.c 2007-08-31 21:24:39 UTC (rev 3043)
@@ -706,16 +706,18 @@
* 0 oops, did not work out, please try again
* -1 peer talks different language,
* no point in trying again, please go standalone.
+ * -2 We do not have a network config...
*/
int drbd_connect(drbd_dev *mdev)
{
struct socket *s, *sock,*msock;
int try,h;
- D_ASSERT(mdev->state.conn >= Unconnected);
D_ASSERT(!mdev->data.socket);
- if(drbd_request_state(mdev,NS(conn,WFConnection)) < SS_Success ) return 0;
+ if (_drbd_request_state(mdev,NS(conn,WFConnection),0) < SS_Success )
+ return -2;
+
clear_bit(DISCARD_CONCURRENT, &mdev->flags);
sock = NULL;
@@ -2688,6 +2690,7 @@
int rv=SS_UnknownError;
D_ASSERT(mdev->state.conn < Connected);
+ if (mdev->state.conn == StandAlone) return;
/* FIXME verify that:
* the state change magic prevents us from becoming >= Connected again
* while we are still cleaning up.
@@ -3102,7 +3105,7 @@
drbd_disconnect(mdev);
schedule_timeout(HZ);
}
- if( h < 0 ) {
+ if( h == -1 ) {
WARN("Discarding network configuration.\n");
drbd_force_state(mdev,NS(conn,Disconnecting));
}
Modified: branches/drbd-8.0/drbd/drbd_strings.c
===================================================================
--- branches/drbd-8.0/drbd/drbd_strings.c 2007-08-31 12:33:54 UTC (rev 3042)
+++ branches/drbd-8.0/drbd/drbd_strings.c 2007-08-31 21:24:39 UTC (rev 3043)
@@ -80,7 +80,8 @@
[-SS_CW_FailedByPeer] = "State changed was refused by peer node",
[-SS_IsDiskLess] =
"Device is diskless, the requesed operation requires a disk",
- [-SS_DeviceInUse] = "Device is held open by someone"
+ [-SS_DeviceInUse] = "Device is held open by someone",
+ [-SS_NoNetConfig] = "Have no net/connection configuration"
};
const char* conns_to_name(drbd_conns_t s) {
@@ -100,7 +101,7 @@
}
const char* set_st_err_name(set_st_err_t err) {
- return err < SS_DeviceInUse ? "TOO_SMALL" :
+ return err < SS_NoNetConfig ? "TOO_SMALL" :
err > SS_TwoPrimaries ? "TOO_LARGE"
: drbd_state_sw_errors[-err];
}
Modified: branches/drbd-8.0/drbd/linux/drbd.h
===================================================================
--- branches/drbd-8.0/drbd/linux/drbd.h 2007-08-31 12:33:54 UTC (rev 3042)
+++ branches/drbd-8.0/drbd/linux/drbd.h 2007-08-31 21:24:39 UTC (rev 3043)
@@ -207,7 +207,8 @@
SS_AlreadyStandAlone=-9,
SS_CW_FailedByPeer=-10,
SS_IsDiskLess=-11,
- SS_DeviceInUse=-12
+ SS_DeviceInUse=-12,
+ SS_NoNetConfig=-13
} set_st_err_t;
/* from drbd_strings.c */
More information about the drbd-cvs
mailing list