[DRBD-cvs] svn commit by phil - r2049 - in trunk: . drbd - * There was a bug with the new mdev->bc way of storing

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Wed Jan 18 15:13:29 CET 2006


Author: phil
Date: 2006-01-18 15:13:28 +0100 (Wed, 18 Jan 2006)
New Revision: 2049

Modified:
   trunk/ROADMAP
   trunk/drbd/drbd_fs.c
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_receiver.c
   trunk/drbd/drbd_req.c
   trunk/drbd/drbd_worker.c
Log:
* There was a bug with the new mdev->bc way of storing the
  backing_bdev's informations. It crashed the kernel when 
  trying IO on a diskless device. FIXED.

* Tested and fixed the new drbd_md_sync() code, and the md_sync...
  timer mechanism.

* Made writing of the meta data super block verbose.

* Fixed the logic to set the MDF_ConnectedInd.

* Began to reduce the number of writes to the meta data super block.   


Modified: trunk/ROADMAP
===================================================================
--- trunk/ROADMAP	2006-01-14 17:28:02 UTC (rev 2048)
+++ trunk/ROADMAP	2006-01-18 14:13:28 UTC (rev 2049)
@@ -646,9 +646,8 @@
    99% DONE
 
 24 Make it possible to hot-add disk drives == Atomic configuration changes.
-   Missing: Think about and test detach/attach of the primary's disk.
 
-   80% DONE [ The net and disk config changes are atomic by now ]
+   99% DONE
 
 25 Add reserved fields to DRBD-meta-data, add a bytes per bit field to
    metadata.
@@ -660,7 +659,7 @@
    that always keeps the on disk-metadata up-to-date implicit. 
    Calling drbd_md_write() explicit is too errorprone.
 
-   90% DONE [ Needs testing, drbd_md_sync() is the new call ]
+   99% DONE
 
 28 Implement a kind of 'call home', a single HTTP get request, that
    gets counted in a data base. The initiator calculates a simple

Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2006-01-14 17:28:02 UTC (rev 2048)
+++ trunk/drbd/drbd_fs.c	2006-01-18 14:13:28 UTC (rev 2049)
@@ -898,6 +898,8 @@
 		drbd_send_state(mdev);
 	}
 
+	drbd_md_sync(mdev);
+
 	return 0;
 
  fail:

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2006-01-14 17:28:02 UTC (rev 2048)
+++ trunk/drbd/drbd_main.c	2006-01-18 14:13:28 UTC (rev 2049)
@@ -754,16 +754,18 @@
 {
 	u32 mdf;
 
-	mdf = mdev->bc->md.flags & ~(MDF_Consistent|MDF_PrimaryInd|
-				     MDF_ConnectedInd|MDF_WasUpToDate);
-	if (mdev->state.role == Primary)        mdf |= MDF_PrimaryInd;
-	if (mdev->state.conn >= WFReportParams) mdf |= MDF_ConnectedInd;
-	if (mdev->state.disk >  Inconsistent)   mdf |= MDF_Consistent;
-	if (mdev->state.disk >  Outdated)       mdf |= MDF_WasUpToDate;
+	if(mdev->bc) {
+		mdf = mdev->bc->md.flags & ~(MDF_Consistent|MDF_PrimaryInd|
+					     MDF_ConnectedInd|MDF_WasUpToDate);
+		if (mdev->state.role == Primary)       mdf |= MDF_PrimaryInd;
+		if (mdev->state.conn > WFReportParams) mdf |= MDF_ConnectedInd;
+		if (mdev->state.disk > Inconsistent)   mdf |= MDF_Consistent;
+		if (mdev->state.disk > Outdated)       mdf |= MDF_WasUpToDate;
 
-	if( mdf != mdev->bc->md.flags) {
-		mdev->bc->md.flags = mdf;
-		drbd_md_mark_dirty(mdev);
+		if( mdf != mdev->bc->md.flags) {
+			mdev->bc->md.flags = mdf;
+			drbd_md_mark_dirty(mdev);
+		}
 	}
 
 	/* Here we have the actions that are performed after a
@@ -818,7 +820,6 @@
 	        ns.aftr_isp == 0 && ns.user_isp == 0   ) {
 		drbd_send_short_cmd(mdev,ResumeResync);
 	}
-	drbd_md_sync(mdev);
 }
 
 
@@ -2420,8 +2421,8 @@
 	int i;
 
 	if (!test_and_clear_bit(MD_DIRTY,&mdev->flags)) return;
-	del_timer(&mdev->resync_timer);
-
+	del_timer(&mdev->md_sync_timer);
+	INFO("Writing meta data super block now.\n");
 	ERR_IF(!inc_md_only(mdev,Attaching)) return;
 
 	down(&mdev->md_io_mutex);
@@ -2549,7 +2550,7 @@
 void drbd_md_mark_dirty(drbd_dev *mdev)
 {
 	set_bit(MD_DIRTY,&mdev->flags);
-	mod_timer(&mdev->resync_timer,jiffies + HZ );
+	mod_timer(&mdev->md_sync_timer,jiffies + HZ );
 }
 
 static void drbd_uuid_move_history(drbd_dev *mdev)
@@ -2638,13 +2639,12 @@
 {
 	drbd_dev* mdev = (drbd_dev*) data;
 
-	WARN("md_sync_timer expired!\n");
 	drbd_queue_work_front(mdev,&mdev->data.work,&mdev->md_sync_work);
 }
 
 STATIC int w_md_sync(drbd_dev *mdev, struct drbd_work *w, int unused)
 {
-	WARN("Worker calls drbd_md_sync() now.\n");
+	WARN("BUG! md_sync_timer expired! Worker calls drbd_md_sync().\n");
 	drbd_md_sync(mdev);
 
 	return 1;

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2006-01-14 17:28:02 UTC (rev 2048)
+++ trunk/drbd/drbd_receiver.c	2006-01-18 14:13:28 UTC (rev 2049)
@@ -2418,9 +2418,9 @@
 			drbd_disks_t nps = drbd_try_outdate_peer(mdev);
 			drbd_request_state(mdev,NS(pdsk,nps));
 		}
-		drbd_md_sync(mdev);
 	}
 
+	drbd_md_sync(mdev);
 	INFO("Connection lost.\n");
 }
 

Modified: trunk/drbd/drbd_req.c
===================================================================
--- trunk/drbd/drbd_req.c	2006-01-14 17:28:02 UTC (rev 2048)
+++ trunk/drbd/drbd_req.c	2006-01-18 14:13:28 UTC (rev 2049)
@@ -208,7 +208,6 @@
 		req->master_bio  = bio_src;
 		req->private_bio = bio;
 
-		bio->bi_bdev     = mdev->bc->backing_bdev;
 		bio->bi_private  = req;
 		bio->bi_end_io   =
 			bio_data_dir(bio) == WRITE
@@ -377,6 +376,7 @@
 
 		// in 2.4.X, READA are submitted as READ.
 		req->private_bio->bi_rw = rw;
+		req->private_bio->bi_bdev = mdev->bc->backing_bdev;
 		generic_make_request(req->private_bio);
 	}
 

Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c	2006-01-14 17:28:02 UTC (rev 2048)
+++ trunk/drbd/drbd_worker.c	2006-01-18 14:13:28 UTC (rev 2049)
@@ -433,6 +433,9 @@
 	drbd_request_state(mdev,NS3(conn,Connected,
 				    disk,UpToDate,
 				    pdsk,UpToDate));
+
+	drbd_md_sync(mdev);
+
 	return 1;
 }
 
@@ -818,6 +821,8 @@
 			D_ASSERT(!test_bit(STOP_SYNC_TIMER,&mdev->flags));
 			mod_timer(&mdev->resync_timer,jiffies);
 		}
+
+		drbd_md_sync(mdev);
 	}
 }
 



More information about the drbd-cvs mailing list