[DRBD-cvs] svn commit by lars - r2412 - trunk/drbd - started to find a few dereferences of mdev->bc where it

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Wed Sep 13 13:53:19 CEST 2006


Author: lars
Date: 2006-09-13 13:53:17 +0200 (Wed, 13 Sep 2006)
New Revision: 2412

Modified:
   trunk/drbd/drbd_fs.c
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_main.c
Log:

started to find a few dereferences of mdev->bc
where it NULL... there are a few more of those,
still :(



Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2006-09-13 10:40:36 UTC (rev 2411)
+++ trunk/drbd/drbd_fs.c	2006-09-13 11:53:17 UTC (rev 2412)
@@ -114,6 +114,9 @@
 
 	wait_event(mdev->al_wait, lc_try_lock(mdev->act_log));
 
+	/* FIXME how to handle DISKLESS?
+	 * mdev->bc may be NULL !! */
+
 	prev_first_sect = drbd_md_first_sector(mdev->bc);
 	prev_size = mdev->bc->md.md_size_sect;
 	la_size = mdev->bc->md.la_size_sect;

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2006-09-13 10:40:36 UTC (rev 2411)
+++ trunk/drbd/drbd_int.h	2006-09-13 11:53:17 UTC (rev 2412)
@@ -1709,6 +1709,7 @@
 {
 	int rv;
 #if !defined(QUEUE_FLAG_ORDERED)
+	ERR_IF(mdev->bc == NULL) return QUEUE_ORDERED_NONE;
 	rv = bdev_get_queue(mdev->bc->backing_bdev)->ordered;
 #else
 # define QUEUE_ORDERED_NONE 0

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2006-09-13 10:40:36 UTC (rev 2411)
+++ trunk/drbd/drbd_main.c	2006-09-13 11:53:17 UTC (rev 2412)
@@ -1189,7 +1189,10 @@
 	int i;
 
 	for (i = Current; i < UUID_SIZE; i++) {
-		p.uuid[i] = cpu_to_be64(mdev->bc->md.uuid[i]);
+		/* FIXME howto handle diskless ? */
+		p.uuid[i] = mdev->bc
+			? cpu_to_be64(mdev->bc->md.uuid[i])
+			: 0;
 	}
 
 	p.uuid[UUID_SIZE] = cpu_to_be64(drbd_bm_total_weight(mdev));
@@ -1219,13 +1222,16 @@
 		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);
+		p.queue_order_type = cpu_to_be32(drbd_queue_order_type(mdev));
 		dec_local(mdev);
-	} else d_size = 0;
+	} else {
+		d_size = 0;
+		p.queue_order_type = cpu_to_be32(QUEUE_ORDERED_NONE);
+	}
 
 	p.d_size = cpu_to_be64(d_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(drbd_queue_order_type(mdev));
 
 	ok = drbd_send_cmd(mdev,USE_DATA_SOCKET,ReportSizes,
 			   (Drbd_Header*)&p,sizeof(p));



More information about the drbd-cvs mailing list