[DRBD-cvs] drbd by phil; * In case no resync happens but there ar...

drbd-user@lists.linbit.com drbd-user@lists.linbit.com
Sat, 6 Mar 2004 10:31:32 +0100 (CET)


DRBD CVS committal

Author  : phil
Module  : drbd

Dir     : drbd/drbd


Modified Files:
      Tag: rel-0_7-branch
	drbd_fs.c drbd_receiver.c 


Log Message:
* In case no resync happens but there are bits set in the bitmap
  (E.g. someone used write_gc.pl) we stepped on some ASSERTS later.
  Now we clear the bitmap in case there are marks in it and we
  do not do a resync.

* In case we mark everything as out of sync ( == It was not possible
  to read metadata), mdev->rs_total was not set correctly.

===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_fs.c,v
retrieving revision 1.28.2.75
retrieving revision 1.28.2.76
diff -u -3 -r1.28.2.75 -r1.28.2.76
--- drbd_fs.c	4 Mar 2004 21:10:08 -0000	1.28.2.75
+++ drbd_fs.c	6 Mar 2004 09:31:27 -0000	1.28.2.76
@@ -327,6 +327,7 @@
 	else {
 		INFO("Assuming that all blocks are out of sync (aka FullSync)\n");
 		bm_fill_bm(mdev->mbds_id,-1);
+		mdev->rs_total = drbd_get_capacity(mdev->this_bdev);
 		drbd_write_bm(mdev);
 	}
 
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_receiver.c,v
retrieving revision 1.97.2.115
retrieving revision 1.97.2.116
diff -u -3 -r1.97.2.115 -r1.97.2.116
--- drbd_receiver.c	6 Mar 2004 08:45:28 -0000	1.97.2.115
+++ drbd_receiver.c	6 Mar 2004 09:31:27 -0000	1.97.2.116
@@ -1253,7 +1253,21 @@
 				mdev->gen_cnt[Flags] &= ~MDF_Consistent;
 				set_cstate(mdev,WFBitMapT);
 			} 
-		} else set_cstate(mdev,Connected);
+		} else {
+			set_cstate(mdev,Connected);
+			if(mdev->rs_total) {
+				/* We are not going to do a resync but there
+				   are marks in the bitmap. 
+				   (Could be from the AL, or someone used
+				   the write_gc.pl program)
+				   Clean the bitmap...
+				 */
+				INFO("No resync -> clearing bit map.\n");
+				bm_fill_bm(mdev->mbds_id,0);
+				mdev->rs_total = 0;
+				drbd_write_bm(mdev);
+			}
+		}
 
 		if (have_good == -1) {
 			/* Sync-Target has to adopt source's gen_cnt. */