[DRBD-cvs] svn commit by simon - r2428 - trunk/drbd - Fixes a crash
if you try to connect two diskless nodes.
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Mon Sep 18 13:58:43 CEST 2006
Author: simon
Date: 2006-09-18 13:58:41 +0200 (Mon, 18 Sep 2006)
New Revision: 2428
Modified:
trunk/drbd/drbd_int.h
trunk/drbd/drbd_main.c
trunk/drbd/drbd_receiver.c
trunk/drbd/drbd_worker.c
Log:
Fixes a crash if you try to connect two diskless nodes.
* Made sure that the exiting worker calls w_disconnect as well.
* The very last action of the exiting worker is the
module_put(THIS_MODULE).
* Changed (nearly) all calls to drbd_thread_stop() in after_state_ch()
to the asynchronous variant.
Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h 2006-09-15 13:14:25 UTC (rev 2427)
+++ trunk/drbd/drbd_int.h 2006-09-18 11:58:41 UTC (rev 2428)
@@ -711,7 +711,7 @@
CLUSTER_ST_CHANGE, // Cluster wide state change going on...
CL_ST_CHG_SUCCESS,
CL_ST_CHG_FAIL,
- CRASHED_PRIMARY // This node was a crashed primary
+ CRASHED_PRIMARY // This node was a crashed primary
};
struct drbd_bitmap; // opaque for Drbd_Conf
Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c 2006-09-15 13:14:25 UTC (rev 2427)
+++ trunk/drbd/drbd_main.c 2006-09-18 11:58:41 UTC (rev 2428)
@@ -987,7 +987,7 @@
}
if ( os.conn != StandAlone && ns.conn == StandAlone ) {
- drbd_thread_stop(&mdev->receiver);
+ drbd_thread_stop_nowait(&mdev->receiver);
}
if ( os.conn != Unconnected && ns.conn == Unconnected ) {
@@ -1003,9 +1003,7 @@
/* it feels better to have the module_put last ... */
if ( (os.disk > Diskless || os.conn > StandAlone) &&
ns.disk == Diskless && ns.conn == StandAlone ) {
- drbd_thread_stop(&mdev->worker);
- drbd_mdev_cleanup(mdev);
- module_put(THIS_MODULE);
+ drbd_thread_stop_nowait(&mdev->worker);
}
}
@@ -2011,7 +2009,7 @@
mdev->rs_total =
mdev->rs_mark_left =
mdev->rs_mark_time = 0;
- mdev->net_conf = NULL;
+ D_ASSERT(mdev->net_conf == NULL);
drbd_set_my_capacity(mdev,0);
drbd_bm_resize(mdev,0);
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2006-09-15 13:14:25 UTC (rev 2427)
+++ trunk/drbd/drbd_receiver.c 2006-09-18 11:58:41 UTC (rev 2428)
@@ -1431,7 +1431,7 @@
if(mdev->state.pdsk <= Inconsistent) {
// In case we have the only disk of the cluster,
drbd_set_out_of_sync(mdev,e->sector,e->size);
- e->flags >= CALL_AL_COMPLETE_IO;
+ e->flags |= CALL_AL_COMPLETE_IO;
drbd_al_begin_io(mdev, e->sector);
}
Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c 2006-09-15 13:14:25 UTC (rev 2427)
+++ trunk/drbd/drbd_worker.c 2006-09-18 11:58:41 UTC (rev 2428)
@@ -680,6 +680,11 @@
if(w) kfree(w);
+ if(mdev->state.conn == StandAlone && mdev->net_conf ) {
+ kfree(mdev->net_conf);
+ mdev->net_conf = NULL;
+ }
+
return 1;
}
@@ -1082,8 +1087,10 @@
i++; /* dead debugging code */
}
+ drbd_thread_stop(&mdev->receiver);
+
spin_lock_irq(&mdev->data.work.q_lock);
- ERR_IF(!list_empty(&mdev->data.work.q))
+ if(!list_empty(&mdev->data.work.q))
goto again;
sema_init(&mdev->data.work.s,0);
/* DANGEROUS race: if someone did queue his work within the spinlock,
@@ -1093,6 +1100,10 @@
*/
spin_unlock_irq(&mdev->data.work.q_lock);
+ D_ASSERT( mdev->state.disk == Diskless && mdev->state.conn == StandAlone );
+ drbd_mdev_cleanup(mdev);
+ module_put(THIS_MODULE);
+
INFO("worker terminated\n");
return 0;
More information about the drbd-cvs
mailing list