[Drbd-dev] [PATCH] drbd-utils: Fix the default node id initialization when upgrade v8 to v9

Nick Wang nwang at suse.com
Fri Jan 13 07:15:58 CET 2017


Node id will be initialized as "0" in md_convert_08_to_09() when upgrading to drbd9 
(still using two nodes without changing configuration like expliciting set the node id). 
However, "0" is legal as a node id, which may cause an "ambiguous node id" error on certain 
node when starting the resource. It is more appropriate to use "-1" as the default node id 
when initializing meta data.
This issue can be reporduced on the drbd-utils-8.9.10.

Error happened when starting service after creating md in drbd9, command are as follow:
upgrade-2:~ # drbdadm create-md single
You want me to create a v09 style flexible-size internal meta data block.
There appears to be a v08 flexible-size internal meta data block
already in place on /dev/vdb5 at byte offset 1073737728

Valid v08 meta-data found, convert to v09?
[need to type 'yes' to confirm] yes

Writing meta data...
New drbd meta data block successfully created.

upgrade-2:~ # drbdadm up single
3: Failure: (119) No valid meta-data signature found.

    ==> Use 'drbdadm create-md res' to initialize meta-data area. <==

Command 'drbdsetup attach 3 /dev/vdb5 /dev/vdb5 internal --on-io-error=pass_on' terminated with exit code 10

upgrade-2:~ # drbdadm status single
single role:Secondary
  disk:Diskless
  upgrade-1 connection:StandAlone

Error log messages in node "upgrade-2":
drbd single/0 drbd3: ambiguous node id: meta-data: 0, config: 1

Signed-off-by: Nick Wang <nwang at suse.com>
CC: Lars Ellenberg <lars.ellenberg at linbit.com>
CC: Roland Kammerer <roland.kammerer at linbit.com>
CC: drbd-dev at lists.linbit.com 

---
 user/shared/drbdmeta.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/user/shared/drbdmeta.c b/user/shared/drbdmeta.c
index 9a28984..e2a9606 100644
--- a/user/shared/drbdmeta.c
+++ b/user/shared/drbdmeta.c
@@ -3868,6 +3868,7 @@ void md_convert_08_to_09(struct format *cfg)
 
 	cfg->md.flags &= ~(MDF_CONNECTED_IND | MDF_FULL_SYNC | MDF_PEER_OUT_DATED);
 
+	cfg->md.node_id = -1;
 	cfg->md.magic = DRBD_MD_MAGIC_09;
 	re_initialize_md_offsets(cfg);
 
-- 
1.8.5.6



More information about the drbd-dev mailing list