volser: allow clonevol purge id to be new id
authorDerrick Brashear <shadow@dementix.org>
Tue, 13 Dec 2011 16:24:16 +0000 (11:24 -0500)
committerDerrick Brashear <shadow@dementix.org>
Mon, 20 Feb 2012 15:53:36 +0000 (07:53 -0800)
effectively the same functionality that reclone already uses, but
for some reason we artificially limit it out of clone despite
the interface being there for it. it used to be there. put it back.

Change-Id: I22868c41f8d3b920ba61d01e5334ff2320b38376
Reviewed-on: http://gerrit.openafs.org/6250
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/volser/volprocs.c

index cdf8ce8..29d3229 100644 (file)
@@ -782,13 +782,17 @@ VolClone(struct rx_call *acid, afs_int32 atrans, afs_uint32 purgeId,
     salv_vp = originalvp;
 #endif
 
-    newvp =
-       VCreateVolume(&error, originalvp->partition->name, newId,
-                     V_parentId(originalvp));
-    if (error) {
-       Log("1 Volser: Clone: Couldn't create new volume; clone aborted\n");
-       newvp = (Volume *) 0;
-       goto fail;
+    if (purgeId == newId) {
+       newvp = purgevp;
+    } else {
+       newvp =
+           VCreateVolume(&error, originalvp->partition->name, newId,
+                         V_parentId(originalvp));
+       if (error) {
+           Log("1 Volser: Clone: Couldn't create new volume; clone aborted\n");
+           newvp = (Volume *) 0;
+           goto fail;
+       }
     }
     if (newType == readonlyVolume)
        V_cloneId(originalvp) = newId;