]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
vos: Avoid creating volume with the same RO/BK ids
authorAndrew Deason <adeason@sinenomine.net>
Wed, 20 Jun 2012 21:28:51 +0000 (16:28 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 22 Mar 2013 14:01:41 +0000 (07:01 -0700)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 234bedae6ef506ec1ff53854a22548e892db3f11)

Change-Id: I332fed5b8cac23a847a8890188f899cff909f130
Reviewed-on: http://gerrit.openafs.org/9488
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/volser/vsprocs.c

index a6dcb659b9bd9b3ce4457b3f881d965faf4f038c..9a949fcd8ef56418ab680ed2c71264dd450b6bf5 100644 (file)
@@ -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;
     }