From 72ce52692f388587cbccc29180e0bd3f47d70cc8 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. Reviewed-on: http://gerrit.openafs.org/7603 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit 234bedae6ef506ec1ff53854a22548e892db3f11) Change-Id: I332fed5b8cac23a847a8890188f899cff909f130 Reviewed-on: http://gerrit.openafs.org/9488 Tested-by: BuildBot Reviewed-by: Derrick Brashear Reviewed-by: Benjamin Kaduk Reviewed-by: Stephan Wiesand --- src/volser/vsprocs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index a6dcb659b..9a949fcd8 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -780,6 +780,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