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 <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
Andrew Deason 2012-06-20 16:28:51 -05:00 committed by Derrick Brashear
parent 5800b7f23c
commit 234bedae6e

View File

@ -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;
}