From 234bedae6ef506ec1ff53854a22548e892db3f11 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 20 Jun 2012 16:28:51 -0500 Subject: [PATCH] vos: Avoid creating volume with the same RO/BK ids If we specified an RW id of 5, an RO id of 6, and no BK id, this code would assign the BK id to RW+1, or 6. This gives the RO and BK volumes the same volume id, which is a mistake. Choose a different id instead. Change-Id: I7910008dd6147a95d482337f91926e9e0d924b9e Reviewed-on: http://gerrit.openafs.org/7603 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/volser/vsprocs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index 0ac7e1e2f..f02fe44db 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -761,6 +761,12 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname, /* rw,ro, bk id are related in the default case */ /* If caller specified RW id, but not RO/BK ids, have them be RW+1 and RW+2 */ lastid = *anewid; + if (aroid && *aroid != 0) { + lastid = MAX(lastid, *aroid); + } + if (abkid && *abkid != 0) { + lastid = MAX(lastid, *abkid); + } if (aroid && *aroid == 0) { *aroid = ++lastid; } -- 2.39.5