[DRBD-cvs] svn commit by phil - r2476 - in trunk: drbd drbd/linux
scripts - * The sync param packet should not carry sync_after, ot
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Thu Sep 28 14:29:31 CEST 2006
Author: phil
Date: 2006-09-28 14:29:29 +0200 (Thu, 28 Sep 2006)
New Revision: 2476
Modified:
trunk/drbd/drbd_int.h
trunk/drbd/drbd_main.c
trunk/drbd/drbd_nl.c
trunk/drbd/drbd_receiver.c
trunk/drbd/drbd_strings.c
trunk/drbd/drbd_worker.c
trunk/drbd/linux/drbd.h
trunk/scripts/drbd
Log:
* The sync param packet should not carry sync_after, otherwise
the sync_after information might be invalid on the receiver's
side.
* In case of an protocol error, the receiver exited instead of
restarting itself.dr
* converted the ASSERTS() at the end of the receiver to ERR_IF
so it is more robust against logic errors.
* The '/etc/init.d/drbd' script should no longer wait for udev
to create the device nodes after loading the module. But it
should wait after the devices are configured.
Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h 2006-09-28 11:18:39 UTC (rev 2475)
+++ trunk/drbd/drbd_int.h 2006-09-28 12:29:29 UTC (rev 2476)
@@ -500,7 +500,6 @@
typedef struct {
Drbd_Header head;
u32 rate;
- u32 after;
} __attribute((packed)) Drbd_SyncParam_Packet;
typedef struct {
Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c 2006-09-28 11:18:39 UTC (rev 2475)
+++ trunk/drbd/drbd_main.c 2006-09-28 12:29:29 UTC (rev 2476)
@@ -1235,7 +1235,6 @@
Drbd_SyncParam_Packet p;
p.rate = cpu_to_be32(sc->rate);
- p.after = cpu_to_be32(sc->after);
return drbd_send_cmd(mdev,USE_DATA_SOCKET,SyncParam,(Drbd_Header*)&p,sizeof(p));
}
Modified: trunk/drbd/drbd_nl.c
===================================================================
--- trunk/drbd/drbd_nl.c 2006-09-28 11:18:39 UTC (rev 2475)
+++ trunk/drbd/drbd_nl.c 2006-09-28 12:29:29 UTC (rev 2476)
@@ -197,8 +197,9 @@
drbd_state_t mask, val;
drbd_disks_t nps;
- ERR_IF (mdev->this_bdev->bd_contains == 0) {
+ if (mdev->this_bdev->bd_contains == 0) {
// FIXME this masks a bug somewhere else!
+ // I think this is a bug outside of DRBD
mdev->this_bdev->bd_contains = mdev->this_bdev;
}
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2006-09-28 11:18:39 UTC (rev 2475)
+++ trunk/drbd/drbd_receiver.c 2006-09-28 12:29:29 UTC (rev 2476)
@@ -1903,7 +1903,6 @@
// XXX harmless race with ioctl ...
mdev->sync_conf.rate = be32_to_cpu(p->rate);
- drbd_alter_sa(mdev, be32_to_cpu(p->after));
return ok;
}
@@ -2398,11 +2397,13 @@
if (unlikely(!handler)) {
ERR("unknown packet type %d, l: %d!\n",
header->command, header->length);
+ drbd_force_state(mdev,NS(conn,ProtocolError));
break;
}
if (unlikely(!handler(mdev,header))) {
ERR("error receiving %s, l: %d!\n",
cmdname(header->command), header->length);
+ drbd_force_state(mdev,NS(conn,ProtocolError));
break;
}
@@ -2542,7 +2543,6 @@
spin_unlock_irq(&mdev->req_lock);
if (rv == SS_Success) {
after_state_ch(mdev,os,ns,ChgStateVerbose);
- D_ASSERT(mdev->receiver.t_state == Restarting);
}
if(os.conn == Disconnecting) {
@@ -2565,7 +2565,6 @@
kfree(mdev->net_conf);
mdev->net_conf=NULL;
drbd_request_state(mdev, NS(conn,StandAlone));
- D_ASSERT(mdev->receiver.t_state == Exiting);
}
/* they do trigger all the time.
@@ -2858,6 +2857,15 @@
drbd_disconnect(mdev);
+ // Ensure that the thread state fits to our connection state.
+ if( mdev->state.conn == Unconnected ) {
+ ERR_IF( mdev->receiver.t_state != Restarting )
+ drbd_thread_restart_nowait(&mdev->receiver);
+ } else if( mdev->state.conn == StandAlone ) {
+ ERR_IF( mdev->receiver.t_state != Exiting )
+ drbd_thread_stop_nowait(&mdev->receiver);
+ }
+
INFO("receiver terminated\n");
return 0;
}
Modified: trunk/drbd/drbd_strings.c
===================================================================
--- trunk/drbd/drbd_strings.c 2006-09-28 11:18:39 UTC (rev 2475)
+++ trunk/drbd/drbd_strings.c 2006-09-28 12:29:29 UTC (rev 2476)
@@ -29,6 +29,7 @@
[Timeout] = "Timeout",
[BrokenPipe] = "BrokenPipe",
[NetworkFailure] = "NetworkFailure",
+ [ProtocolError] = "ProtocolError",
[WFConnection] = "WFConnection",
[WFReportParams] = "WFReportParams",
[TearDown] = "TearDown",
Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c 2006-09-28 11:18:39 UTC (rev 2475)
+++ trunk/drbd/drbd_worker.c 2006-09-28 12:29:29 UTC (rev 2476)
@@ -728,6 +728,7 @@
while(1) {
if( odev->sync_conf.after == -1 ) return 1;
odev = minor_to_mdev(odev->sync_conf.after);
+ ERR_IF(!odev) return 1;
if( odev->state.conn >= SyncSource &&
odev->state.conn <= PausedSyncT ) return 0;
}
Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h 2006-09-28 11:18:39 UTC (rev 2475)
+++ trunk/drbd/linux/drbd.h 2006-09-28 12:29:29 UTC (rev 2476)
@@ -137,6 +137,7 @@
Timeout, /// These temporal states are all used on the way
BrokenPipe, /// from >= Connected to Unconnected.
NetworkFailure, /// The 'disconnect reason' states
+ ProtocolError, ///
TearDown, /// I do not allow to change beween them.
WFConnection,
WFReportParams, // we have a socket
Modified: trunk/scripts/drbd
===================================================================
--- trunk/scripts/drbd 2006-09-28 11:18:39 UTC (rev 2475)
+++ trunk/scripts/drbd 2006-09-28 12:29:29 UTC (rev 2476)
@@ -39,17 +39,6 @@
}
# tell klogd to reload module symbol information ...
[ -e /var/run/klogd.pid ] && [ -x /sbin/klogd ] && /sbin/klogd -i
-
- # make sure udev has time to create the device files
- for RESOURCE in `$DRBDADM sh-resources`; do
- for DEVICE in `$DRBDADM sh-dev $RESOURCE`; do
- UDEV_TIMEOUT_LOCAL=$UDEV_TIMEOUT
- while [ ! -e $DEVICE ] && [ $UDEV_TIMEOUT_LOCAL -gt 0 ] ; do
- sleep 1
- UDEV_TIMEOUT_LOCAL=$(( $UDEV_TIMEOUT_LOCAL-1 ))
- done
- done
- done
}
function adjust_with_progress
@@ -93,6 +82,18 @@
echo -n "Starting DRBD resources: "
assure_module_is_loaded
adjust_with_progress
+
+ # make sure udev has time to create the device files
+ for RESOURCE in `$DRBDADM sh-resources`; do
+ for DEVICE in `$DRBDADM sh-dev $RESOURCE`; do
+ UDEV_TIMEOUT_LOCAL=$UDEV_TIMEOUT
+ while [ ! -e $DEVICE ] && [ $UDEV_TIMEOUT_LOCAL -gt 0 ] ; do
+ sleep 1
+ UDEV_TIMEOUT_LOCAL=$(( $UDEV_TIMEOUT_LOCAL-1 ))
+ done
+ done
+ done
+
[ -d /var/lock/subsys ] && touch /var/lock/subsys/drbd # for RedHat
echo "."
$DRBDADM wait-con-int # User interruptible version of wait-connect all
More information about the drbd-cvs
mailing list