[DRBD-cvs] svn commit by phil - r2417 - trunk/drbd - Found and
fixed quite a number of places where we had a
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Wed Sep 13 18:36:00 CEST 2006
Author: phil
Date: 2006-09-13 18:35:59 +0200 (Wed, 13 Sep 2006)
New Revision: 2417
Modified:
trunk/drbd/drbd_main.c
trunk/drbd/drbd_nl.c
trunk/drbd/drbd_receiver.c
Log:
Found and fixed quite a number of places where we had accesses to
mdev->bc, that where not protected by inc_local() / dec_local()
Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c 2006-09-13 13:50:34 UTC (rev 2416)
+++ trunk/drbd/drbd_main.c 2006-09-13 16:35:59 UTC (rev 2417)
@@ -1193,6 +1193,8 @@
Drbd_GenCnt_Packet p;
int i;
+ if(!inc_local(mdev)) return 1; // ok
+
for (i = Current; i < UUID_SIZE; i++) {
/* FIXME howto handle diskless ? */
p.uuid[i] = mdev->bc
@@ -1203,6 +1205,8 @@
p.uuid[UUID_SIZE] = cpu_to_be64(drbd_bm_total_weight(mdev));
p.uuid[UUID_FLAGS] = cpu_to_be64(mdev->net_conf->want_lose);
+ dec_local(mdev);
+
return drbd_send_cmd(mdev,USE_DATA_SOCKET,ReportUUIDs,
(Drbd_Header*)&p,sizeof(p));
}
@@ -1220,23 +1224,28 @@
int drbd_send_sizes(drbd_dev *mdev)
{
Drbd_Sizes_Packet p;
- sector_t d_size;
+ sector_t d_size, u_size;
+ int q_order_type;
int ok;
- if(inc_local_if_state(mdev,Attaching)) {
+ if(inc_local(mdev)) {
D_ASSERT(mdev->bc->backing_bdev);
d_size = drbd_get_max_capacity(mdev->bc);
- p.u_size = cpu_to_be64(mdev->bc->dc.disk_size);
+ u_size = mdev->bc->dc.disk_size;
+ q_order_type = drbd_queue_order_type(mdev);
p.queue_order_type = cpu_to_be32(drbd_queue_order_type(mdev));
dec_local(mdev);
} else {
d_size = 0;
- p.queue_order_type = cpu_to_be32(QUEUE_ORDERED_NONE);
+ u_size = 0;
+ q_order_type = QUEUE_ORDERED_NONE;
}
p.d_size = cpu_to_be64(d_size);
+ p.u_size = cpu_to_be64(u_size);
p.c_size = cpu_to_be64(drbd_get_capacity(mdev->this_bdev));
p.max_segment_size = cpu_to_be32(mdev->rq_queue->max_segment_size);
+ p.queue_order_type = cpu_to_be32(q_order_type);
ok = drbd_send_cmd(mdev,USE_DATA_SOCKET,ReportSizes,
(Drbd_Header*)&p,sizeof(p));
Modified: trunk/drbd/drbd_nl.c
===================================================================
--- trunk/drbd/drbd_nl.c 2006-09-13 13:50:34 UTC (rev 2416)
+++ trunk/drbd/drbd_nl.c 2006-09-13 16:35:59 UTC (rev 2417)
@@ -568,13 +568,15 @@
q->seg_boundary_mask = PAGE_SIZE-1;
blk_queue_stack_limits(q, b);
- if( old_max_seg_s != q->max_segment_size ) {
- if(b->merge_bvec_fn) {
- WARN("Backing device has merge_bvec_fn()!\n");
- }
+
+ if(b->merge_bvec_fn) {
+ WARN("Backing device has merge_bvec_fn()!\n");
+ }
+
+ //if( old_max_seg_s != q->max_segment_size ) {
INFO("max_segment_size ( = BIO size ) = %u\n",
q->max_segment_size);
- }
+ //}
if( q->backing_dev_info.ra_pages != b->backing_dev_info.ra_pages) {
INFO("Adjusting my ra_pages to backing device's (%lu -> %lu)\n",
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2006-09-13 13:50:34 UTC (rev 2416)
+++ trunk/drbd/drbd_receiver.c 2006-09-13 16:35:59 UTC (rev 2417)
@@ -1984,15 +1984,18 @@
#undef min_not_zero
mdev->p_size=p_size;
- drbd_bm_lock(mdev); // {
- /*
- * you may get a flip-flop connection established/connection loss, in
- * case both really have different usize uppon first connect!
- * try to solve it thus:
- ***/
+ if(inc_local(mdev)) {
+ drbd_bm_lock(mdev); // {
+ /*
+ * you may get a flip-flop connection established/connection loss,
+ * in case both really have different usize uppon first connect!
+ * try to solve it thus:
+ ***/
- drbd_determin_dev_size(mdev);
- drbd_bm_unlock(mdev); // }
+ drbd_determin_dev_size(mdev);
+ drbd_bm_unlock(mdev); // }
+ dec_local(mdev);
+ }
if (mdev->p_uuid && mdev->state.conn <= Connected && inc_local(mdev)) {
nconn=drbd_sync_handshake(mdev,mdev->state.peer,mdev->state.pdsk);
@@ -2007,13 +2010,16 @@
}
}
- max_seg_s = be32_to_cpu(p->max_segment_size);
- if( max_seg_s != mdev->rq_queue->max_segment_size ) {
- drbd_setup_queue_param(mdev, max_seg_s);
+ if(inc_local(mdev)) {
+ max_seg_s = be32_to_cpu(p->max_segment_size);
+ if( max_seg_s != mdev->rq_queue->max_segment_size ) {
+ drbd_setup_queue_param(mdev, max_seg_s);
+ }
+
+ drbd_setup_order_type(mdev,be32_to_cpu(p->queue_order_type));
+ dec_local(mdev);
}
- drbd_setup_order_type(mdev,be32_to_cpu(p->queue_order_type));
-
if (mdev->state.conn > WFReportParams ) {
if( be64_to_cpu(p->c_size) !=
drbd_get_capacity(mdev->this_bdev) ) {
@@ -2121,8 +2127,7 @@
peer_state.i = be32_to_cpu(p->state);
- if (mdev->p_uuid && mdev->state.conn <= Connected &&
- inc_local_if_state(mdev,Attaching) ) {
+ if (mdev->p_uuid && mdev->state.conn <= Connected && inc_local(mdev) ) {
nconn=drbd_sync_handshake(mdev,peer_state.role,peer_state.disk);
dec_local(mdev);
More information about the drbd-cvs
mailing list