[DRBD-cvs] svn commit by phil - r3090 - branches/drbd-8.0/user - The v07 to v08 meta data conversion was broken since th

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Thu Oct 4 11:40:52 CEST 2007


Author: phil
Date: 2007-10-04 11:40:51 +0200 (Thu, 04 Oct 2007)
New Revision: 3090

Modified:
   branches/drbd-8.0/user/drbdmeta.c
Log:
The v07 to v08 meta data conversion was broken since the md_size is 
in KB in the v07 meta data and in units of sectors (512byte) in v08
metadata.

When you try to up a resource then with DRBD 8 you will get this 
in the logfile:

 kernel: drbd0: disk( Diskless -> Attaching )
 kernel: drbd0: unexpected md_size: 131072 (expected 262144)
 kernel: drbd0: disk( Attaching -> Diskless )
 
The workaround, to get the broken meta-data fixed is:

drbdmeta /dev/drbd0 v08 /dev/sda5 0 dump-md > /tmp/dump
dd if=/dev/zero of=/dev/sda5 bs=4096 count=1
drbdmeta /dev/drbd0 v08 /dev/sda5 0 create-md
drbdmeta /dev/drbd0 v08 /dev/sda5 0 restore-md /tmp/dump

This commit fixes drbdmeta, so that the meta-data conversion
works in the first place.


Modified: branches/drbd-8.0/user/drbdmeta.c
===================================================================
--- branches/drbd-8.0/user/drbdmeta.c	2007-10-03 13:45:44 UTC (rev 3089)
+++ branches/drbd-8.0/user/drbdmeta.c	2007-10-04 09:40:51 UTC (rev 3090)
@@ -413,7 +413,7 @@
 	be_u64 la_kb;		/* last agreed size. */
 	be_u32 gc[GEN_CNT_SIZE];	/* generation counter */
 	be_u32 magic;
-	be_u32 md_size_sect;
+	be_u32 md_size_kb;
 	be_s32 al_offset;	/* signed sector offset to this block */
 	be_u32 al_nr_extents;	/* important for restoring the AL */
 	be_s32 bm_offset;	/* signed sector offset to the bitmap, from here */
@@ -429,7 +429,7 @@
 	for (i = 0; i < GEN_CNT_SIZE; i++)
 		cpu->gc[i] = be32_to_cpu(disk->gc[i].be);
 	cpu->magic = be32_to_cpu(disk->magic.be);
-	cpu->md_size_sect = be32_to_cpu(disk->md_size_sect.be);
+	cpu->md_size_sect = be32_to_cpu(disk->md_size_kb.be) << 1;
 	cpu->al_offset = be32_to_cpu(disk->al_offset.be);
 	cpu->al_nr_extents = be32_to_cpu(disk->al_nr_extents.be);
 	cpu->bm_offset = be32_to_cpu(disk->bm_offset.be);
@@ -444,7 +444,7 @@
 	for (i = 0; i < GEN_CNT_SIZE; i++)
 		disk->gc[i].be = cpu_to_be32(cpu->gc[i]);
 	disk->magic.be = cpu_to_be32(cpu->magic);
-	disk->md_size_sect.be = cpu_to_be32(cpu->md_size_sect);
+	disk->md_size_kb.be = cpu_to_be32(cpu->md_size_sect >> 1);
 	disk->al_offset.be = cpu_to_be32(cpu->al_offset);
 	disk->al_nr_extents.be = cpu_to_be32(cpu->al_nr_extents);
 	disk->bm_offset.be = cpu_to_be32(cpu->bm_offset);



More information about the drbd-cvs mailing list