[DRBD-cvs] svn commit by phil - r2083 - branches/drbd-0.7/drbd - Got a very detailed bug report, description and patch f

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Tue Feb 28 11:55:55 CET 2006


Author: phil
Date: 2006-02-28 11:55:54 +0100 (Tue, 28 Feb 2006)
New Revision: 2083

Modified:
   branches/drbd-0.7/drbd/drbd_actlog.c
   branches/drbd-0.7/drbd/drbd_fs.c
Log:
Got a very detailed bug report, description and patch from Luo Jinhua.

* The AL was not applied in case the user selected a non standard AL
  size after a primary crash. Fixed.
* When reading the AL, the last change AL-entry might not become 
  restored correctly. Fixed.


Modified: branches/drbd-0.7/drbd/drbd_actlog.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_actlog.c	2006-02-26 11:56:57 UTC (rev 2082)
+++ branches/drbd-0.7/drbd/drbd_actlog.c	2006-02-28 10:55:54 UTC (rev 2083)
@@ -453,7 +453,12 @@
 		trn=be32_to_cpu(buffer->tr_number);
 
 		spin_lock_irq(&mdev->al_lock);
-		for(j=0;j<AL_EXTENTS_PT+1;j++) {
+
+		/* This loop runs backwards because in the cyclic 
+		   elements there might be an old version of the
+		   updated element (in slot 0). So the element in slot 0
+		   can overwrite old versions. */
+		for(j=AL_EXTENTS_PT;j>=0;j--) {
 			pos = be32_to_cpu(buffer->updates[j].pos);
 			extent_nr = be32_to_cpu(buffer->updates[j].extent);
 

Modified: branches/drbd-0.7/drbd/drbd_fs.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_fs.c	2006-02-26 11:56:57 UTC (rev 2082)
+++ branches/drbd-0.7/drbd/drbd_fs.c	2006-02-28 10:55:54 UTC (rev 2083)
@@ -263,7 +263,7 @@
 			struct ioctl_disk_config * arg)
 {
 	NOT_IN_26(int err;) // unused in 26 ?? cannot believe it ...
-	int i, md_gc_valid, minor, mput=0;
+	int i, md_gc_valid, minor, mput=0, apply_al;
 	enum ret_codes retcode;
 	struct disk_config new_conf;
 	struct file *filp = 0;
@@ -520,6 +520,13 @@
 		if (put_user(retcode, &arg->ret_code)) return -EFAULT;
 		return -EINVAL;
 	}
+
+	apply_al = drbd_md_test_flag(mdev,MDF_PrimaryInd);
+	/* All tests on MDF_PrimaryInd and MDF_ConnectedInd must happen before 
+	   this point, because determin_dev_size() might call drbd_md_write(), 
+	   which in turn modifies these flags. Exceptions are where, we want
+	   to test the current state (drbd_md_compare(), drbd_send_param()). */
+
 	if (drbd_determin_dev_size(mdev) < 0) {
 		/* could not allocate bitmap.
 		 * try to undo ... */
@@ -561,7 +568,7 @@
 
 	if (md_gc_valid > 0) {
 		drbd_al_read_log(mdev);
-		if (drbd_md_test_flag(mdev,MDF_PrimaryInd)) {
+		if (apply_al) {
 			drbd_al_apply_to_bm(mdev);
 			drbd_al_to_on_disk_bm(mdev);
 		}



More information about the drbd-cvs mailing list