[OpenAFS-devel] Patch to add much more diagnostics to vos move when run with -verbose

Nathan Neulinger nneul@umr.edu
Wed, 6 Feb 2002 08:27:31 -0600


--ikeVEW9yuYc//A+q
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Also removes the "WARNING" from "WARNING : removing backup volume on source", which
really doesn't need to be a warning since it's completely expected, and
you can't back out at that point any way.

A vos move -verbose looks like this now:

------
infinity(3)>/tmp/vos move sw.tnsnames afs2 a afs2 b -verbose
Locking VLDB entry for volume 536977586 ... done
Starting transaction on source volume 536977586 ... done
Allocating new volume id for clone of volume 536977586 ... done
Cloning source volume 536977586 ... done
Ending the transaction on the source volume 536977586 ... done
Starting transaction on the cloned volume 537067336 ... done
Setting flags on cloned volume 537067336 ... done
Getting status of cloned volume 537067336 ... done
Creating the destination volume 536977586 ... done
Setting volume flags on destination volume 536977586 ... done
Dumping from clone 537067336 on source to volume 536977586 on destination ... done
Ending transaction on cloned volume 537067336 ... done
Starting transaction on source volume 536977586 ... done
Doing the incremental dump from source to destination for volume 536977586 ...  done
Setting volume flags on old source volume 536977586 ... done
Setting volume flags on new source volume 536977586 ... done
Ending transaction on destination volume 536977586 ... done
Releasing lock on VLDB entry for volume 536977586 ... done
Deleting old volume 536977586 on source ... done
Ending transaction on old volume 536977586 on the source ... done
Creating transaction for backup volume 536977588 on source ... done
No backup volume exists on source. Ignoring.
Starting transaction on the cloned volume 537067336 ... done
Deleting the clone 537067336 ... done
Ending transaction on clone volume 537067336 ... done
WARNING : readOnly copies still exist 
Volume 536977586 moved from afs2 /vicepa to afs2 /vicepb 
------

There are also more "what's happening" diagnostics during recovery and 
cleanup operations.


-- Nathan

------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul@umr.edu
University of Missouri - Rolla         Phone: (573) 341-4841
Computing Services                       Fax: (573) 341-4216

--ikeVEW9yuYc//A+q
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="vos-move-more-diag.diff"

Index: vsprocs.c
===================================================================
RCS file: /cvs/openafs/src/volser/vsprocs.c,v
retrieving revision 1.10
diff -u -r1.10 vsprocs.c
--- vsprocs.c	2001/10/08 22:55:41	1.10
+++ vsprocs.c	2002/02/06 14:24:01
@@ -567,7 +567,7 @@
     /* create the vldb entry */
     vcode = VLDB_CreateEntry(&storeEntry);
     if(vcode) {
-	fprintf(STDERR,"Could not create a VLDB entry for the  volume %s %u\n", aname,aid);
+	fprintf(STDERR,"Could not create a VLDB entry for the volume %s %u\n", aname,aid);
 	error = vcode;
 	goto cfail;
     }
@@ -836,34 +836,38 @@
 }
 
 #define ONERR(ec, es, ep) if (ec) { fprintf(STDERR, (es), (ep)); PrintError("   ",ec); error = (ec); goto mfail; }
+#define VPRINT(es) if (verbose) { fprintf(STDOUT, (es)); fflush(STDOUT); }
+#define VPRINT1(es, vol) if (verbose) { fprintf(STDOUT, (es), (vol)); fflush(STDOUT); }
+#define VPRINT2(es, vol1, vol2) if (verbose) { fprintf(STDOUT, (es), (vol1), (vol2)); fflush(STDOUT); }
+#define VDONE if (verbose) { fprintf(STDOUT, " done\n"); fflush(STDOUT); }
 
 /* Move volume <afromvol> on <afromserver> <afrompart> to <atoserver>
  * <atopart>. The operation is almost idempotent 
  */
 
 UV_MoveVolume(afromvol, afromserver, afrompart, atoserver, atopart)
-     afs_int32 afromvol; 
-     afs_int32 afromserver, atoserver;
-     afs_int32 afrompart,   atopart;
+afs_int32 afromvol;
+afs_int32 afromserver, atoserver;
+afs_int32 afrompart, atopart;
 {
-    struct rx_connection *toconn, *fromconn ;
-    afs_int32                fromtid, totid, clonetid;
-    char                 vname[64];
-    char                 *volName = 0;
-    char                 tmpName[VOLSER_MAXVOLNAME +1];
-    afs_int32                rcode;
-    afs_int32                fromDate;
+    struct rx_connection *toconn, *fromconn;
+    afs_int32 fromtid, totid, clonetid;
+    char vname[64];
+    char *volName = 0;
+    char tmpName[VOLSER_MAXVOLNAME + 1];
+    afs_int32 rcode;
+    afs_int32 fromDate;
     struct restoreCookie cookie;
-    register afs_int32       vcode, code;
-    afs_int32                newVol, volid, backupId;
+    register afs_int32 vcode, code;
+    afs_int32 newVol, volid, backupId;
     struct volser_status tstatus;
-    struct destServer    destination;
+    struct destServer destination;
 
-    struct nvldbentry    entry, storeEntry;
-    int                  i, islocked, pntg;
-    afs_int32                error;
-    char                 in,lf;	                        /* for test code */
-    int                  same;
+    struct nvldbentry entry, storeEntry;
+    int i, islocked, pntg;
+    afs_int32 error;
+    char in, lf;                /* for test code */
+    int same;
 
 #ifdef	ENABLE_BUGFIX_1165
     volEntries volumeInfo;
@@ -871,211 +875,273 @@
 #endif
 
     islocked = 0;
-    fromconn = (struct rx_connection *)0;
-    toconn   = (struct rx_connection *)0;
-    fromtid  = 0;
-    totid    = 0;
+    fromconn = (struct rx_connection *) 0;
+    toconn = (struct rx_connection *) 0;
+    fromtid = 0;
+    totid = 0;
     clonetid = 0;
-    error    = 0;
-    volid    = 0;
-    pntg     = 0;
+    error = 0;
+    volid = 0;
+    pntg = 0;
     backupId = 0;
-    newVol   = 0;
+    newVol = 0;
 
     /* support control-c processing */
-    if (setjmp(env)) goto mfail;
-    (void) signal(SIGINT,sigint_handler);
- 
+    if (setjmp(env))
+        goto mfail;
+    (void) signal(SIGINT, sigint_handler);
+
     if (TESTC)
     {
         fprintf(STDOUT,
-		"\nThere are three tests points - verifies all code paths through recovery.\n");
-	fprintf(STDOUT,"First test point - operation not started.\n");
-	fprintf(STDOUT,"...test here (y, n)? ");
-	fflush(STDOUT);
-	fscanf(stdin,"%c",&in);
-	fscanf(stdin,"%c",&lf);	/* toss away */
-	if (in=='y')
-	{
-	    fprintf(STDOUT,"type control-c\n");
-	    while(1)
-	    {
-	        fprintf(stdout,".");
-		fflush(stdout);
-		sleep(1);
-	    }
-	}
-	/* or drop through */
+            "\nThere are three tests points - verifies all code paths through recovery.\n");
+        fprintf(STDOUT, "First test point - operation not started.\n");
+        fprintf(STDOUT, "...test here (y, n)? ");
+        fflush(STDOUT);
+        fscanf(stdin, "%c", &in);
+        fscanf(stdin, "%c", &lf);	/* toss away */
+        if (in == 'y')
+        {
+            fprintf(STDOUT, "type control-c\n");
+            while (1)
+            {
+                fprintf(stdout, ".");
+                fflush(stdout);
+                sleep(1);
+            }
+        }
+        /* or drop through */
     }
 
     vcode = VLDB_GetEntryByID(afromvol, -1, &entry);
-    ONERR (vcode, "Could not fetch the entry for the volume  %u from the VLDB \n", afromvol);
+    ONERR(vcode,
+        "Could not fetch the entry for the volume %u from the VLDB \n",
+        afromvol);
 
     if (entry.volumeId[RWVOL] != afromvol)
     {
-	fprintf(STDERR,"Only RW volume can be moved\n");
-	exit(1);
+        fprintf(STDERR, "Only RW volume can be moved\n");
+        exit(1);
     }
 
-    vcode = ubik_Call(VL_SetLock, cstruct, 0,afromvol, RWVOL, VLOP_MOVE);
-    ONERR (vcode, "Could not lock entry for volume %u \n", afromvol);
+    VPRINT1("Locking VLDB entry for volume %u ...", afromvol);
+    vcode = ubik_Call(VL_SetLock, cstruct, 0, afromvol, RWVOL, VLOP_MOVE);
+    ONERR(vcode, "Could not lock entry for volume %u\n", afromvol);
+    VDONE;
     islocked = 1;
 
-    vcode = VLDB_GetEntryByID (afromvol, RWVOL, &entry);
-    ONERR (vcode, "Could not fetch the entry for the volume  %u from the VLDB \n", afromvol);
+    vcode = VLDB_GetEntryByID(afromvol, RWVOL, &entry);
+    ONERR(vcode,
+        "Could not fetch the entry for the volume %u from the VLDB\n",
+        afromvol);
 
     backupId = entry.volumeId[BACKVOL];
     MapHostToNetwork(&entry);
 
-    if ( !Lp_Match(afromserver, afrompart, &entry) )
+    if (!Lp_Match(afromserver, afrompart, &entry))
     {
-	/* the from server and partition do not exist in the vldb entry corresponding to volid */
-	if ( !Lp_Match(atoserver, atopart, &entry) ) 
-	{
-	    /* the to server and partition do not exist in the vldb entry corresponding to volid */
-	    fprintf(STDERR,"The volume %u is not on the specified site. \n", afromvol);
-	    fprintf(STDERR,"The current site is :");
-	    for (i=0; i<entry.nServers; i++)
-	    {
-		if (entry.serverFlags[i] == ITSRWVOL)
-		{
-		    char pname[10];
-		    MapPartIdIntoName(entry.serverPartition[i],pname);
-		    fprintf(STDERR," server %s partition %s \n",
-			    hostutil_GetNameByINet(entry.serverNumber[i]), pname);
-		}
-	    }
-	    vcode = ubik_Call(VL_ReleaseLock, cstruct, 0, afromvol, -1,
-			      (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
-	    ONERR (vcode, " Could not release lock on the VLDB entry for the volume %u \n",
-		   afromvol);
-
-	    return VOLSERVOLMOVED;
-	}
-
-	/* delete the volume afromvol on src_server */
-	/* from-info does not exist but to-info does =>
-	 * we have already done the move, but the volume
-	 * may still be existing physically on from fileserver
-	 */
-	fromconn = UV_Bind(afromserver, AFSCONF_VOLUMEPORT);
-	fromtid = 0;
-	pntg = 1;
-
-	code = AFSVolTransCreate(fromconn, afromvol, afrompart, ITOffline, &fromtid);
-	if (!code) 
-	{   /* volume exists - delete it */
-	    code = AFSVolSetFlags(fromconn, fromtid, VTDeleteOnSalvage | VTOutOfService);
-	    ONERR (code, "Failed to set flags on the volume %u\n", afromvol);
-
-	    code = AFSVolDeleteVolume(fromconn,fromtid);
-	    ONERR (code, "Failed to delete the volume %u\n", afromvol);
-	    
-	    code = AFSVolEndTrans(fromconn, fromtid, &rcode);
-	    fromtid = 0;
-	    if (!code) code = rcode;
-	    ONERR (code, "Could not end the transaction for the volume %u \n", afromvol);
-	}
-
-	/*delete the backup volume now */
-	fromtid = 0;
-	code = AFSVolTransCreate(fromconn, backupId, afrompart, ITOffline, &fromtid);
-	if (!code) 
-	{   /* backup volume exists - delete it */
-	    code = AFSVolSetFlags(fromconn, fromtid, VTDeleteOnSalvage | VTOutOfService);
-	    ONERR (code, "Failed to set flags on the backup volume %u\n", backupId);
-
-	    code = AFSVolDeleteVolume(fromconn,fromtid);
-	    ONERR (code, "Could not delete the backup volume %u\n", backupId);
-
-	    code = AFSVolEndTrans(fromconn, fromtid, &rcode);
-	    fromtid = 0;
-	    if (!code) code = rcode;
-	    ONERR (code,"Could not end the transaction for the backup volume %u \n",backupId);
-	}
-
-	fromtid = 0;
-	error = 0;
-	goto mfail;
+        /* the from server and partition do not exist in the vldb entry corresponding to volid */
+        if (!Lp_Match(atoserver, atopart, &entry))
+        {
+            /* the to server and partition do not exist in the vldb entry corresponding to volid */
+            fprintf(STDERR, "The volume %u is not on the specified site. \n",
+                afromvol);
+            fprintf(STDERR, "The current site is :");
+            for (i = 0; i < entry.nServers; i++)
+            {
+                if (entry.serverFlags[i] == ITSRWVOL)
+                {
+                    char pname[10];
+
+                    MapPartIdIntoName(entry.serverPartition[i], pname);
+                    fprintf(STDERR, " server %s partition %s \n",
+                        hostutil_GetNameByINet(entry.serverNumber[i]), pname);
+                }
+            }
+            VPRINT1("Releasing lock on VLDB entry for volume %u ...",
+                afromvol);
+            vcode =
+                ubik_Call(VL_ReleaseLock, cstruct, 0, afromvol, -1,
+                (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
+            ONERR(vcode,
+                " Could not release lock on the VLDB entry for the volume %u \n",
+                afromvol);
+            VDONE;
+
+            return VOLSERVOLMOVED;
+        }
+
+        /* delete the volume afromvol on src_server */
+        /* from-info does not exist but to-info does =>
+         * we have already done the move, but the volume
+         * may still be existing physically on from fileserver
+         */
+        fromconn = UV_Bind(afromserver, AFSCONF_VOLUMEPORT);
+        fromtid = 0;
+        pntg = 1;
+
+        code =
+            AFSVolTransCreate(fromconn, afromvol, afrompart, ITOffline,
+            &fromtid);
+        if (!code)
+        {                       /* volume already moved - delete from source */
+            VPRINT1("Setting flags on leftover source volume %u ...",
+                afromvol);
+            code =
+                AFSVolSetFlags(fromconn, fromtid,
+                VTDeleteOnSalvage | VTOutOfService);
+            ONERR(code,
+                "Failed to set flags on the leftover source volume %u\n",
+                afromvol);
+            VDONE;
+
+            VPRINT1("Deleting leftover source volume %u ...", afromvol);
+            code = AFSVolDeleteVolume(fromconn, fromtid);
+            ONERR(code, "Failed to delete the leftover source volume %u\n",
+                afromvol);
+            VDONE;
+
+            VPRINT1("Ending transaction on leftover source volume %u ...",
+                afromvol);
+            code = AFSVolEndTrans(fromconn, fromtid, &rcode);
+            fromtid = 0;
+            if (!code)
+                code = rcode;
+            ONERR(code,
+                "Could not end the transaction for the leftover source volume %u \n",
+                afromvol);
+            VDONE;
+        }
+
+        /*delete the backup volume now */
+        fromtid = 0;
+        code =
+            AFSVolTransCreate(fromconn, backupId, afrompart, ITOffline,
+            &fromtid);
+        if (!code)
+        {                       /* backup volume exists - delete it */
+            VPRINT1("Setting flags on leftover backup volume %u ...",
+                backupId);
+            code =
+                AFSVolSetFlags(fromconn, fromtid,
+                VTDeleteOnSalvage | VTOutOfService);
+            ONERR(code,
+                "Failed to set flags on the leftover backup volume %u\n",
+                backupId);
+            VDONE;
+
+            VPRINT1("Deleting backup volume %u ...", backupId);
+            code = AFSVolDeleteVolume(fromconn, fromtid);
+            ONERR(code, "Could not delete the leftover backup volume %u\n",
+                backupId);
+            VDONE;
+
+            VPRINT1("Ending transaction on leftover backup volume %u ...",
+                backupId);
+            code = AFSVolEndTrans(fromconn, fromtid, &rcode);
+            fromtid = 0;
+            if (!code)
+                code = rcode;
+            ONERR(code,
+                "Could not end the transaction for the leftover backup volume %u \n",
+                backupId);
+            VDONE;
+        }
+
+        fromtid = 0;
+        error = 0;
+        goto mfail;
     }
 
     /* From-info matches the vldb info about volid,
      * its ok start the move operation, the backup volume 
      * on the old site is deleted in the process 
      */
-    if (afrompart == atopart) 
+    if (afrompart == atopart)
     {
-        same = VLDB_IsSameAddrs (afromserver, atoserver, &error);
-	if (error) 
-	{
-	    fprintf(STDERR, "Failed to get info about server's %d address(es) from vlserver (err=%d); aborting call!\n", 
-		    afromserver, error);
-	    goto mfail;
-	}
-	if (same) ONERR (VOLSERVOLMOVED, 
-			 "Warning: Moving volume %u to its home partition ignored!\n", afromvol);
+        same = VLDB_IsSameAddrs(afromserver, atoserver, &error);
+        if (error)
+        {
+            fprintf(STDERR,
+                "Failed to get info about server's %d address(es) from vlserver (err=%d); aborting call!\n",
+                afromserver, error);
+            goto mfail;
+        }
+        if (same)
+            ONERR(VOLSERVOLMOVED,
+                "Warning: Moving volume %u to its home partition ignored!\n",
+                afromvol);
     }
 
     pntg = 1;
-    toconn   = UV_Bind(atoserver,   AFSCONF_VOLUMEPORT); /* get connections to the servers */
+    toconn = UV_Bind(atoserver, AFSCONF_VOLUMEPORT);	/* get connections to the servers */
     fromconn = UV_Bind(afromserver, AFSCONF_VOLUMEPORT);
-    fromtid = totid = 0;	/* initialize to uncreated */
+    fromtid = totid = 0;        /* initialize to uncreated */
 
     /* ***
      * clone the read/write volume locally.
      * ***/
 
-    if (verbose) fprintf(STDOUT,"Starting transaction on source volume %u ...",afromvol);
+    VPRINT1("Starting transaction on source volume %u ...", afromvol);
     fflush(STDOUT);
     code = AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy, &fromtid);
-    ONERR (code, "Failed to create transaction on the volume %u\n", afromvol);
-    if (verbose) fprintf(STDOUT," done\n");
+    ONERR(code, "Failed to create transaction on the volume %u\n", afromvol);
+    VDONE;
 
     /* Get a clone id */
+    VPRINT1("Allocating new volume id for clone of volume %u ...", afromvol);
     newVol = 0;
-    vcode = ubik_Call (VL_GetNewVolumeId, cstruct, 0, 1, &newVol);
-    ONERR (vcode, "Could not get an ID for the clone of volume %u from the VLDB\n", afromvol);
+    vcode = ubik_Call(VL_GetNewVolumeId, cstruct, 0, 1, &newVol);
+    ONERR(vcode,
+        "Could not get an ID for the clone of volume %u from the VLDB\n",
+        afromvol);
+    VDONE;
 
     /* Do the clone. Default flags on clone are set to delete on salvage and out of service */
-    if (verbose) fprintf (STDOUT,"Cloning source volume %u ...", afromvol);
-    fflush(STDOUT);
-    strcpy(vname, "move-clone-temp");
-    code = AFSVolClone(fromconn, fromtid, 0,readonlyVolume, vname, &newVol);
-    ONERR (code, "Failed to clone the source volume %u\n", afromvol);
-    if (verbose) fprintf(STDOUT," done\n");
+    VPRINT1("Cloning source volume %u ...", afromvol);
+    strcpy(vname, "move-clone-temp");	/* why the strcpy? is that name special cased on server? */
+    code = AFSVolClone(fromconn, fromtid, 0, readonlyVolume, vname, &newVol);
+    ONERR(code, "Failed to clone the source volume %u\n", afromvol);
+    VDONE;
 
     /* lookup the name of the volume we just cloned */
     volid = afromvol;
     code = AFSVolGetName(fromconn, fromtid, &volName);
-    ONERR (code, "Failed to get the name of the volume %u\n", newVol);
+    ONERR(code, "Failed to get the name of the volume %u\n", newVol);
 
-    if (verbose) fprintf (STDOUT,"Ending the transaction on the source volume %u ...", afromvol);
-    fflush(STDOUT);
+    VPRINT1("Ending the transaction on the source volume %u ...", afromvol);
     rcode = 0;
     code = AFSVolEndTrans(fromconn, fromtid, &rcode);
     fromtid = 0;
-    if (!code) code = rcode;
-    ONERR (code, "Failed to end the transaction on the source volume %u\n", afromvol);
-    if (verbose) fprintf (STDOUT," done\n");
+    if (!code)
+        code = rcode;
+    ONERR(code, "Failed to end the transaction on the source volume %u\n",
+        afromvol);
+    VDONE;
 
     /* ***
      * Create the destination volume
      * ***/
-
-    if (verbose) fprintf(STDOUT, "Starting transaction on the cloned volume %u ...", newVol);
-    fflush(STDOUT);
-    code = AFSVolTransCreate (fromconn, newVol, afrompart, ITOffline, &clonetid);
-    ONERR (code, "Failed to start a transaction on the cloned volume%u\n", newVol);
-    if (verbose) fprintf(STDOUT," done\n");
 
-    code = AFSVolSetFlags (fromconn, clonetid, VTDeleteOnSalvage|VTOutOfService); /*redundant */
-    ONERR (code, "Could not set falgs on the cloned volume %u\n", newVol);
+    VPRINT1("Starting transaction on the cloned volume %u ...", newVol);
+    code =
+        AFSVolTransCreate(fromconn, newVol, afrompart, ITOffline, &clonetid);
+    ONERR(code, "Failed to start a transaction on the cloned volume%u\n",
+        newVol);
+    VDONE;
+
+    VPRINT1("Setting flags on cloned volume %u ...", newVol);
+    code = AFSVolSetFlags(fromconn, clonetid, VTDeleteOnSalvage | VTOutOfService);	/*redundant */
+    ONERR(code, "Could not set flags on the cloned volume %u\n", newVol);
+    VDONE;
 
     /* remember time from which we've dumped the volume */
-    code = AFSVolGetStatus (fromconn, clonetid, &tstatus);
-    ONERR (code, "Failed to get the status of the cloned volume %u\n", newVol);
+    VPRINT1("Getting status of cloned volume %u ...", newVol);
+    code = AFSVolGetStatus(fromconn, clonetid, &tstatus);
+    ONERR(code, "Failed to get the status of the cloned volume %u\n", newVol);
+    VDONE;
 
-    fromDate = tstatus.creationDate-CLOCKSKEW;
+    fromDate = tstatus.creationDate - CLOCKSKEW;
 
 #ifdef	ENABLE_BUGFIX_1165
     /*
@@ -1083,54 +1149,65 @@
      * to copy it to the new volume (via AFSSetInfo later on) so that when we move volumes we
      * don't use this information...
      */
-    volumeInfo.volEntries_val = (volintInfo *)0;/*this hints the stub to allocate space*/
+    volumeInfo.volEntries_val = (volintInfo *) 0;	/*this hints the stub to allocate space */
     volumeInfo.volEntries_len = 0;
     code = AFSVolListOneVolume(fromconn, afrompart, afromvol, &volumeInfo);
-    ONERR (code, "Failed to get the volint Info of the cloned volume %u\n", afromvol);
+    ONERR(code, "Failed to get the volint Info of the cloned volume %u\n",
+        afromvol);
 
     infop = (volintInfo *) volumeInfo.volEntries_val;
-    infop->maxquota = -1;			/* Else it will replace the default quota */
+    infop->maxquota = -1;       /* Else it will replace the default quota */
 #endif
 
     /* create a volume on the target machine */
     volid = afromvol;
-    code = AFSVolTransCreate (toconn, volid, atopart, ITOffline, &totid);
-    if (!code) 
-    {  
-      /* Delete the existing volume.
-       * While we are deleting the volume in these steps, the transaction
-       * we started against the cloned volume (clonetid above) will be
-       * sitting idle. It will get cleaned up after 600 seconds
-       */
-        if (verbose) fprintf(STDOUT,"Deleting pre-existing volume %u on destination ...",volid);
-	fflush(STDOUT);
-
-	code = AFSVolDeleteVolume(toconn, totid);
-	ONERR (code, "Could not delete the pre-existing volume %u on destination\n", volid);
-	
-	code = AFSVolEndTrans(toconn, totid, &rcode);
-	totid = 0;
-	if (!code) code = rcode;
-	ONERR (code, "Could not end the transaction on pre-existing volume %u on destination\n",
-	       volid);
-
-	if (verbose) fprintf(STDOUT," done\n");
-    }
-
-    if (verbose) fprintf(STDOUT,"Creating the destination volume %u ...",volid);
-    fflush(STDOUT);
-    code = AFSVolCreateVolume (toconn, atopart, volName, volser_RW, volid, &volid, &totid);
-    ONERR (code, "Failed to create the destination volume %u\n", volid);
-    if (verbose) fprintf(STDOUT," done\n");
+    code = AFSVolTransCreate(toconn, volid, atopart, ITOffline, &totid);
+    if (!code)
+    {
+        /* Delete the existing volume.
+         * While we are deleting the volume in these steps, the transaction
+         * we started against the cloned volume (clonetid above) will be
+         * sitting idle. It will get cleaned up after 600 seconds
+         */
+        VPRINT1("Deleting pre-existing volume %u on destination ...", volid);
+        code = AFSVolDeleteVolume(toconn, totid);
+        ONERR(code,
+            "Could not delete the pre-existing volume %u on destination\n",
+            volid);
+        VDONE;
+
+        VPRINT1
+            ("Ending transaction on pre-existing volume %u on destination ...",
+            volid);
+        code = AFSVolEndTrans(toconn, totid, &rcode);
+        totid = 0;
+        if (!code)
+            code = rcode;
+        ONERR(code,
+            "Could not end the transaction on pre-existing volume %u on destination\n",
+            volid);
+        VDONE;
+    }
+
+    VPRINT1("Creating the destination volume %u ...", volid);
+    code =
+        AFSVolCreateVolume(toconn, atopart, volName, volser_RW, volid, &volid,
+        &totid);
+    ONERR(code, "Failed to create the destination volume %u\n", volid);
+    VDONE;
 
     strncpy(tmpName, volName, VOLSER_OLDMAXVOLNAME);
     free(volName);
     volName = (char *) 0;
 
-    code = AFSVolSetFlags (toconn, totid, (VTDeleteOnSalvage | VTOutOfService));
-    ONERR(code, "Failed to set the flags on the destination volume %u\n", volid);
+    VPRINT1("Setting volume flags on destination volume %u ...", volid);
+    code =
+        AFSVolSetFlags(toconn, totid, (VTDeleteOnSalvage | VTOutOfService));
+    ONERR(code, "Failed to set the flags on the destination volume %u\n",
+        volid);
+    VDONE;
 
-    /***
+	/***
      * Now dump the clone to the new volume
      ***/
 
@@ -1139,110 +1216,135 @@
     destination.destSSID = 1;
 
     /* Copy the clone to the new volume */
-    if (verbose) fprintf(STDOUT, "Dumping from clone %u on source to volume %u on destination ...",
-			 newVol, afromvol);
-    fflush(STDOUT);
-    strncpy(cookie.name,tmpName,VOLSER_OLDMAXVOLNAME);
-    cookie.type   = RWVOL;
+    VPRINT2("Dumping from clone %u on source to volume %u on destination ...",
+        newVol, afromvol);
+    strncpy(cookie.name, tmpName, VOLSER_OLDMAXVOLNAME);
+    cookie.type = RWVOL;
     cookie.parent = entry.volumeId[RWVOL];
-    cookie.clone  = 0;
+    cookie.clone = 0;
     code = AFSVolForward(fromconn, clonetid, 0, &destination, totid, &cookie);
-    ONERR (code, "Failed to move data for the volume %u\n", volid);
-    if (verbose) fprintf(STDOUT," done\n");
+    ONERR(code, "Failed to move data for the volume %u\n", volid);
+    VDONE;
 
+    VPRINT1("Ending transaction on cloned volume %u ...", newVol);
     code = AFSVolEndTrans(fromconn, clonetid, &rcode);
-    if (!code) code = rcode;
+    if (!code)
+        code = rcode;
     clonetid = 0;
-    ONERR (code, "Failed to end the transaction on the cloned volume %u\n", newVol);
+    ONERR(code, "Failed to end the transaction on the cloned volume %u\n",
+        newVol);
+    VDONE;
 
     /* ***
      * reattach to the main-line volume, and incrementally dump it.
      * ***/
 
-    if (verbose) 
-        fprintf(STDOUT,"Doing the incremental dump from source to destination for volume %u ... ", 
-		afromvol);
-    fflush(STDOUT);
-    
+    VPRINT1("Starting transaction on source volume %u ...", afromvol);
     code = AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy, &fromtid);
-    ONERR (code, "Failed to create a transaction on the source volume %u\n", afromvol);
+    ONERR(code, "Failed to create a transaction on the source volume %u\n",
+        afromvol);
+    VDONE;
 
     /* now do the incremental */
-    code = AFSVolForward(fromconn, fromtid, fromDate, &destination, totid,&cookie);
-    ONERR (code, "Failed to do the incremental dump from rw volume on old site to rw volume on newsite\n", 0);
-    if (verbose)fprintf(STDOUT," done\n");
+    VPRINT1
+        ("Doing the incremental dump from source to destination for volume %u ... ",
+        afromvol);
+    code =
+        AFSVolForward(fromconn, fromtid, fromDate, &destination, totid,
+        &cookie);
+    ONERR(code,
+        "Failed to do the incremental dump from rw volume on old site to rw volume on newsite\n",
+        0);
+    VDONE;
 
     /* now adjust the flags so that the new volume becomes official */
+    VPRINT1("Setting volume flags on old source volume %u ...", afromvol);
     code = AFSVolSetFlags(fromconn, fromtid, VTOutOfService);
-    ONERR (code, "Failed to set the flags to make old source volume offline\n", 0);
+    ONERR(code, "Failed to set the flags to make old source volume offline\n",
+        0);
+    VDONE;
 
+    VPRINT1("Setting volume flags on new source volume %u ...", afromvol);
     code = AFSVolSetFlags(toconn, totid, 0);
-    ONERR (code, "Failed to set the flags to make new source volume online\n", 0);
+    ONERR(code, "Failed to set the flags to make new source volume online\n",
+        0);
+    VDONE;
 
 #ifdef	ENABLE_BUGFIX_1165
     code = AFSVolSetInfo(toconn, totid, infop);
-    ONERR (code, "Failed to set volume status on the destination volume %u\n", volid);
+    ONERR(code, "Failed to set volume status on the destination volume %u\n",
+        volid);
 #endif
 
     /* put new volume online */
+    VPRINT1("Ending transaction on destination volume %u ...", afromvol);
     code = AFSVolEndTrans(toconn, totid, &rcode);
     totid = 0;
-    if (!code) code = rcode;
-    ONERR (code, "Failed to end the transaction on the volume %u on the new site\n", afromvol);
+    if (!code)
+        code = rcode;
+    ONERR(code,
+        "Failed to end the transaction on the volume %u on the new site\n",
+        afromvol);
+    VDONE;
 
     Lp_SetRWValue(&entry, afromserver, afrompart, atoserver, atopart);
-    MapNetworkToHost(&entry,&storeEntry);
+    MapNetworkToHost(&entry, &storeEntry);
     storeEntry.flags &= ~BACK_EXISTS;
 
     if (TESTC)
     {
-        fprintf(STDOUT, "Second test point - operation in progress but not complete.\n");
-	fprintf(STDOUT,"...test here (y, n)? ");
-	fflush(STDOUT);
-	fscanf(stdin,"%c",&in);
-	fscanf(stdin,"%c",&lf);	/* toss away */
-	if (in=='y')
-	{
-	    fprintf(STDOUT,"type control-c\n");
-	    while(1)
-	    {
-	        fprintf(stdout,".");
-		fflush(stdout);
-		sleep(1);
-	    }
-	}
-	/* or drop through */
-    }
-
-    vcode = VLDB_ReplaceEntry (afromvol, -1, &storeEntry, 
-			       (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
-    if (vcode) 
+        fprintf(STDOUT,
+            "Second test point - operation in progress but not complete.\n");
+        fprintf(STDOUT, "...test here (y, n)? ");
+        fflush(STDOUT);
+        fscanf(stdin, "%c", &in);
+        fscanf(stdin, "%c", &lf);	/* toss away */
+        if (in == 'y')
+        {
+            fprintf(STDOUT, "type control-c\n");
+            while (1)
+            {
+                fprintf(stdout, ".");
+                fflush(stdout);
+                sleep(1);
+            }
+        }
+        /* or drop through */
+    }
+
+    VPRINT1("Releasing lock on VLDB entry for volume %u ...", afromvol);
+    vcode = VLDB_ReplaceEntry(afromvol, -1, &storeEntry,
+        (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
+    if (vcode)
     {
-        fprintf(STDERR," Could not release the lock on the VLDB entry for the volume %s %u \n",
-		storeEntry.name,afromvol);
-	error = vcode;
-	goto mfail;
+        fprintf(STDERR,
+            " Could not release the lock on the VLDB entry for the volume %s %u \n",
+            storeEntry.name, afromvol);
+        error = vcode;
+        goto mfail;
     }
-    islocked=0;
+    VDONE;
+    islocked = 0;
 
     if (TESTC)
     {
-        fprintf(STDOUT, "Third test point - operation complete but no cleanup.\n");
-	fprintf(STDOUT,"...test here (y, n)? ");
-	fflush(STDOUT);
-	fscanf(stdin,"%c",&in);
-	fscanf(stdin,"%c",&lf);	/* toss away */
-	if (in=='y')
-	{
-	    fprintf(STDOUT,"type control-c\n");
-	    while(1)
-	    {
-	        fprintf(stdout,".");
-		fflush(stdout);
-		sleep(1);
-	    }
-	}
-	/* or drop through */
+        fprintf(STDOUT,
+            "Third test point - operation complete but no cleanup.\n");
+        fprintf(STDOUT, "...test here (y, n)? ");
+        fflush(STDOUT);
+        fscanf(stdin, "%c", &in);
+        fscanf(stdin, "%c", &lf);	/* toss away */
+        if (in == 'y')
+        {
+            fprintf(STDOUT, "type control-c\n");
+            while (1)
+            {
+                fprintf(stdout, ".");
+                fflush(stdout);
+                sleep(1);
+            }
+        }
+        /* or drop through */
     }
 
 #ifdef notdef
@@ -1252,189 +1354,257 @@
      * we're cleaning this code up in DEcorum, we're just going to kludge around
      * it for now by removing this call. */
     /* already out of service, just zap it now */
-    code = AFSVolSetFlags(fromconn, fromtid, VTDeleteOnSalvage | VTOutOfService);
+    code =
+        AFSVolSetFlags(fromconn, fromtid, VTDeleteOnSalvage | VTOutOfService);
     if (code)
     {
-        fprintf(STDERR,"Failed to set the flags to make the old source volume offline\n");
-	goto mfail;
+        fprintf(STDERR,
+            "Failed to set the flags to make the old source volume offline\n");
+        goto mfail;
     }
 #endif
-    if (atoserver != afromserver) 
+    if (atoserver != afromserver)
     {
         /* set forwarding pointer for moved volumes */
+        VPRINT1("Setting forwarding pointer for volume %u ...", afromvol);
         code = AFSVolSetForwarding(fromconn, fromtid, atoserver);
-	ONERR (code, "Failed to set the forwarding pointer for the volume %u\n", afromvol);
+        ONERR(code,
+            "Failed to set the forwarding pointer for the volume %u\n",
+            afromvol);
+        VDONE;
     }
 
-    if (verbose) fprintf(STDOUT,"Deleting old volume %u on source ...", afromvol);
-    fflush(STDOUT);
+    VPRINT1("Deleting old volume %u on source ...", afromvol);
+    code = AFSVolDeleteVolume(fromconn, fromtid);	/* zap original volume */
+    ONERR(code, "Failed to delete the old volume %u on source\n", afromvol);
+    VDONE;
 
-    code = AFSVolDeleteVolume(fromconn,fromtid);	/* zap original volume */
-    ONERR (code, "Failed to delete the old volume %u on source\n", afromvol); 
-    
+    VPRINT1("Ending transaction on old volume %u on the source ...",
+        afromvol);
     code = AFSVolEndTrans(fromconn, fromtid, &rcode);
     fromtid = 0;
-    if (!code) code = rcode;
-    ONERR (code, "Failed to end the transaction on the old volume %u on the source\n", afromvol);
-
-    if (verbose) fprintf(STDOUT," done\n");
+    if (!code)
+        code = rcode;
+    ONERR(code,
+        "Failed to end the transaction on the old volume %u on the source\n",
+        afromvol);
+    VDONE;
 
     /* Delete the backup volume on the original site */
-    code = AFSVolTransCreate(fromconn, backupId, afrompart, ITOffline, &fromtid);
-    if (!code) 
-    {
-        fprintf(STDOUT, "WARNING : Deleting the backup volume %u on the source ...",backupId);
-	fflush(STDOUT);
-
-	code = AFSVolSetFlags(fromconn, fromtid, VTDeleteOnSalvage | VTOutOfService);
-	ONERR (code, "Failed to set the flags on the backup volume on source\n", 0);
-
-	code = AFSVolDeleteVolume(fromconn,fromtid);
-	ONERR (code, "Failed to delete the backup volume on source\n", 0);
-	
-	code = AFSVolEndTrans(fromconn,fromtid, &rcode);
-	fromtid = 0;
-	if (!code) code = rcode;
-	ONERR (code, "Failed to end the transaction on the backup volume %u on source\n", 0);
+    VPRINT1("Creating transaction for backup volume %u on source ...",
+        backupId);
+    code =
+        AFSVolTransCreate(fromconn, backupId, afrompart, ITOffline, &fromtid);
+    VDONE;
 
-	fprintf(STDOUT," done\n");
+    if (!code)                  /* if backup volume exists, otherwise code will be zero */
+    {
+        VPRINT1("Setting flags on backup volume %u on source ...", backupId);
+        code =
+            AFSVolSetFlags(fromconn, fromtid,
+            VTDeleteOnSalvage | VTOutOfService);
+        ONERR(code,
+            "Failed to set the flags on the backup volume on source\n", 0);
+        VDONE;
+
+        VPRINT1("Deleting the backup volume %u on the source ...", backupId);
+        fflush(STDOUT);
+        code = AFSVolDeleteVolume(fromconn, fromtid);
+        ONERR(code, "Failed to delete the backup volume on source\n", 0);
+        VDONE;
+
+        VPRINT1("Ending transaction on backup volume %u on source ...",
+            backupId);
+        code = AFSVolEndTrans(fromconn, fromtid, &rcode);
+        fromtid = 0;
+        if (!code)
+            code = rcode;
+        ONERR(code,
+            "Failed to end the transaction on the backup volume %u on source\n",
+            0);
+        VDONE;
+    }
+    else
+    {
+        VPRINT("No backup volume exists on source. Ignoring.\n");
     }
-    else code = 0;		/* no backup volume? that's okay */
 
+    VPRINT1("Starting transaction on the cloned volume %u ...", newVol);
     fromtid = 0;
-    if (verbose) fprintf(STDOUT,"Starting transaction on the cloned volume %u ...",newVol);
-    fflush(STDOUT);
-
-    code = AFSVolTransCreate(fromconn, newVol, afrompart, ITOffline, &clonetid);
-    ONERR (code, "Failed to start a transaction on the cloned volume%u\n", newVol);
+    code =
+        AFSVolTransCreate(fromconn, newVol, afrompart, ITOffline, &clonetid);
+    ONERR(code, "Failed to start a transaction on the cloned volume%u\n",
+        newVol);
+    VDONE;
 
-    if (verbose) fprintf(STDOUT," done\n");
-    
     /* now delete the clone */
-    if (verbose) fprintf(STDOUT,"Deleting the clone %u ...", newVol);
-    fflush(STDOUT);
-
+    VPRINT1("Deleting the clone %u ...", newVol);
     code = AFSVolDeleteVolume(fromconn, clonetid);
-    ONERR (code, "Failed to delete the cloned volume %u\n", newVol);
-    
-    if (verbose) fprintf(STDOUT," done\n");
+    ONERR(code, "Failed to delete the cloned volume %u\n", newVol);
+    VDONE;
 
+    VPRINT1("Ending transaction on clone volume %u ...", newVol);
     code = AFSVolEndTrans(fromconn, clonetid, &rcode);
-    if (!code) code = rcode;
+    if (!code)
+        code = rcode;
     clonetid = 0;
-    ONERR (code, "Failed to end the transaction on the cloned volume %u\n", newVol);
+    ONERR(code, "Failed to end the transaction on the cloned volume %u\n",
+        newVol);
+    VDONE;
 
     /* fall through */
     /* END OF MOVE */
 
     if (TESTC)
     {
-        fprintf(STDOUT,"Fourth test point - operation complete.\n");
-	fprintf(STDOUT,"...test here (y, n)? ");
-	fflush(STDOUT);
-	fscanf(stdin,"%c",&in);
-	fscanf(stdin,"%c",&lf);	/* toss away */
-	if (in=='y')
-	{
-	    fprintf(STDOUT,"type control-c\n");
-	    while(1)
-	    {
-	        fprintf(stdout,".");
-		fflush(stdout);
-		sleep(1);
-	    }
-	}
-	/* or drop through */
+        fprintf(STDOUT, "Fourth test point - operation complete.\n");
+        fprintf(STDOUT, "...test here (y, n)? ");
+        fflush(STDOUT);
+        fscanf(stdin, "%c", &in);
+        fscanf(stdin, "%c", &lf);	/* toss away */
+        if (in == 'y')
+        {
+            fprintf(STDOUT, "type control-c\n");
+            while (1)
+            {
+                fprintf(stdout, ".");
+                fflush(stdout);
+                sleep(1);
+            }
+        }
+        /* or drop through */
     }
 
     /* normal cleanup code */
 
-    if (entry.flags & RO_EXISTS) fprintf(STDERR,"WARNING : readOnly copies still exist \n");
+    if (entry.flags & RO_EXISTS)
+        fprintf(STDERR, "WARNING : readOnly copies still exist \n");
 
     if (islocked)
     {
-        vcode = ubik_Call(VL_ReleaseLock,cstruct, 0, afromvol, -1, 
-			  (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
-        if (vcode) 
-	{
-	    fprintf(STDERR," Could not release the lock on the VLDB entry for the volume %u \n",
-		    afromvol);
-	    if (!error) error = vcode;
-	}
+        VPRINT1("Cleanup: Releasing VLDB lock on volume %u ...", afromvol);
+        vcode = ubik_Call(VL_ReleaseLock, cstruct, 0, afromvol, -1,
+            (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
+        if (vcode)
+        {
+            fprintf(STDERR,
+                " Could not release the lock on the VLDB entry for the volume %u \n",
+                afromvol);
+            if (!error)
+                error = vcode;
+        }
+        VDONE;
     }
-    
-    if (fromtid) 
+
+    if (fromtid)
     {
-	code = AFSVolEndTrans(fromconn, fromtid, &rcode);
-	if (code || rcode)
-	{
-	    fprintf(STDERR,"Could not end transaction on the source's clone volume %u\n", newVol);
-	    if (!error) error = (code ? code : rcode);
-	}
+        VPRINT1("Cleanup: Ending transaction on source volume %u ...",
+            afromvol);
+        code = AFSVolEndTrans(fromconn, fromtid, &rcode);
+        if (code || rcode)
+        {
+            fprintf(STDERR,
+                "Could not end transaction on source volume %u\n", afromvol);
+            if (!error)
+                error = (code ? code : rcode);
+        }
+        VDONE;
     }
 
-    if (clonetid) 
+    if (clonetid)
     {
-	code = AFSVolEndTrans(fromconn, clonetid, &rcode);
-	if (code || rcode) 
-	{
-	    fprintf(STDERR,"Could not end transaction on the source's clone volume %u\n",newVol);
-	    if (!error) error = (code ? code : rcode);
-	}
+        VPRINT1("Cleanup: Ending transaction on clone volume %u ...", newVol);
+        code = AFSVolEndTrans(fromconn, clonetid, &rcode);
+        if (code || rcode)
+        {
+            fprintf(STDERR,
+                "Could not end transaction on clone volume %u\n", newVol);
+            if (!error)
+                error = (code ? code : rcode);
+        }
+        VDONE;
     }
 
-    if (totid) 
+    if (totid)
     {
-	code = AFSVolEndTrans(toconn, totid, &rcode);
-	if (code) 
-	{
-	    fprintf(STDERR,"Could not end transaction on destination volume %u\n",afromvol);
-	    if (!error) error = (code ? code : rcode);
-	}
+        VPRINT1("Cleanup: Ending transaction on destination volume %u ...",
+            afromvol);
+        code = AFSVolEndTrans(toconn, totid, &rcode);
+        if (code)
+        {
+            fprintf(STDERR,
+                "Could not end transaction on destination volume %u\n",
+                afromvol);
+            if (!error)
+                error = (code ? code : rcode);
+        }
+        VDONE;
     }
-    if (volName) free(volName);
+    if (volName)
+        free(volName);
 #ifdef	ENABLE_BUGFIX_1165
-    if (infop)   free(infop);
+    if (infop)
+        free(infop);
 #endif
-    if (fromconn) rx_DestroyConnection(fromconn);
-    if (toconn)   rx_DestroyConnection(toconn);
-    PrintError("",error);
+    if (fromconn)
+        rx_DestroyConnection(fromconn);
+    if (toconn)
+        rx_DestroyConnection(toconn);
+    PrintError("", error);
     return error;
 
     /* come here only when the sky falls */
-mfail:
+  mfail:
 
-    if (pntg) 
+    if (pntg)
     {
-	fprintf(STDOUT,"vos move: operation interrupted, cleanup in progress...\n");
-	fprintf(STDOUT,"clear transaction contexts\n");
-	fflush(STDOUT);
+        fprintf(STDOUT,
+            "vos move: operation interrupted, cleanup in progress...\n");
+        fprintf(STDOUT, "clear transaction contexts\n");
+        fflush(STDOUT);
     }
 
     /* unlock VLDB entry */
     if (islocked)
+    {
+        VPRINT1("Recovery: Releasing VLDB lock on volume %u ...", afromvol);
         ubik_Call(VL_ReleaseLock, cstruct, 0, afromvol, -1,
-		  (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
+            (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
+        VDONE;
+    }
 
-    if (clonetid) AFSVolEndTrans(fromconn, clonetid, &rcode);
-    if (totid)    AFSVolEndTrans(toconn, totid, &rcode);
-    if (fromtid)
-    {  /* put it on-line */
-        AFSVolSetFlags(fromconn,fromtid,0);
-	AFSVolEndTrans(fromconn, fromtid, &rcode);
+    if (clonetid)
+    {
+        VPRINT("Recovery: Ending transaction on clone volume ...");
+        AFSVolEndTrans(fromconn, clonetid, &rcode);
+        VDONE;
     }
 
-    if (verbose) 
-    {	/* get current VLDB entry */
-	fprintf(STDOUT,"access VLDB\n");
-	fflush(STDOUT);
+    if (totid)
+    {
+        VPRINT("Recovery: Ending transaction on destination volume ...");
+        AFSVolEndTrans(toconn, totid, &rcode);
+        VDONE;
     }
-    vcode= VLDB_GetEntryByID (afromvol, -1, &entry);
+
+    if (fromtid)
+    {                           /* put it on-line */
+        VPRINT("Recovery: Setting volume flags on source volume ...");
+        AFSVolSetFlags(fromconn, fromtid, 0);
+        VDONE;
+
+        VPRINT("Recovery: Ending transaction on source volume ...");
+        AFSVolEndTrans(fromconn, fromtid, &rcode);
+        VDONE;
+    }
+
+    VPRINT("Recovery: Accessing VLDB.\n");
+    vcode = VLDB_GetEntryByID(afromvol, -1, &entry);
     if (vcode)
     {
-        fprintf(STDOUT,"FATAL: VLDB access error: abort cleanup\n");
-	fflush(STDOUT);
-	goto done;
+        fprintf(STDOUT, "FATAL: VLDB access error: abort cleanup\n");
+        fflush(STDOUT);
+        goto done;
     }
     MapHostToNetwork(&entry);
 
@@ -1443,86 +1613,201 @@
      * volume move didn't finish so we remove the volume from the target 
      * location. Otherwise, we remove the volume from the source location.
      */
-    if (Lp_Match(afromserver,afrompart,&entry)) {  /* didn't move - delete target volume */
-        if (pntg) {
-	    fprintf(STDOUT,
-		    "move incomplete - attempt cleanup of target partition - no guarantee\n");
-	    fflush(STDOUT);
-	}
-
-	if (volid && toconn) {
-	    code=AFSVolTransCreate(toconn,volid,atopart, ITOffline,&totid);
-	    if (!code) {
-	        AFSVolSetFlags(toconn,totid, VTDeleteOnSalvage | VTOutOfService);
-		AFSVolDeleteVolume(toconn,totid);
-		AFSVolEndTrans(toconn,totid,&rcode);
-	    }
-	}
-
-	/* put source volume on-line */
-	if (fromconn) {
-	    code=AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy, &fromtid);
-	    if (!code) {
-	        AFSVolSetFlags(fromconn,fromtid,0);
-		AFSVolEndTrans(fromconn,fromtid,&rcode);
-	    }
-	}
+    if (Lp_Match(afromserver, afrompart, &entry))
+    {                           /* didn't move - delete target volume */
+        if (pntg)
+        {
+            fprintf(STDOUT,
+                "move incomplete - attempt cleanup of target partition - no guarantee\n");
+            fflush(STDOUT);
+        }
+
+        if (volid && toconn)
+        {
+            VPRINT1
+                ("Recovery: Creating transaction for destination volume %u ...",
+                volid);
+            code =
+                AFSVolTransCreate(toconn, volid, atopart, ITOffline, &totid);
+            VDONE;
+            if (!code)
+            {
+                VPRINT1
+                    ("Recovery: Setting flags on destination volume %u ...",
+                    volid);
+                AFSVolSetFlags(toconn, totid,
+                    VTDeleteOnSalvage | VTOutOfService);
+                VDONE;
+
+                VPRINT1("Recovery: Deleting destination volume %u ...",
+                    volid);
+                AFSVolDeleteVolume(toconn, totid);
+                VDONE;
+
+                VPRINT1
+                    ("Recovery: Ending transaction on destination volume %u ...",
+                    volid);
+                AFSVolEndTrans(toconn, totid, &rcode);
+                VDONE;
+            }
+            else
+            {
+                VPRINT1
+                    ("Recovery: Unable to start transaction on volume %u.\n",
+                    volid);
+            }
+        }
+
+        /* put source volume on-line */
+        if (fromconn)
+        {
+            VPRINT1("Recovery: Creating transaction on source volume %u ...",
+                afromvol);
+            code =
+                AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy,
+                &fromtid);
+            VDONE;
+
+            if (!code)
+            {
+                VPRINT1("Recovery: Setting flags on source volume %u ...",
+                    afromvol);
+                AFSVolSetFlags(fromconn, fromtid, 0);
+                VDONE;
+
+                VPRINT1
+                    ("Recovery: Ending transaction on source volume %u ...",
+                    afromvol);
+                AFSVolEndTrans(fromconn, fromtid, &rcode);
+                VDONE;
+            }
+            else
+            {
+                VPRINT1
+                    ("Recovery: Unable to start transaction on volume %u.\n",
+                    afromvol);
+            }
+        }
+    }
+    else
+    {                           /* yep, move complete */
+        if (pntg)
+        {
+            fprintf(STDOUT,
+                "move complete - attempt cleanup of source partition - no guarantee\n");
+            fflush(STDOUT);
+        }
+
+        /* delete backup volume */
+        if (fromconn)
+        {
+            VPRINT1("Recovery: Creating transaction on backup volume %u ...",
+                backupId);
+            code =
+                AFSVolTransCreate(fromconn, backupId, afrompart, ITOffline,
+                &fromtid);
+            VDONE;
+            if (!code)
+            {
+				VPRINT1("Recovery: Setting flags on backup volume %u ...", backupId);
+                AFSVolSetFlags(fromconn, fromtid,
+                    VTDeleteOnSalvage | VTOutOfService);
+				VDONE;
+
+				VPRINT1("Recovery: Deleting backup volume %u ...", backupId);
+                AFSVolDeleteVolume(fromconn, fromtid);
+				VDONE;
+
+				VPRINT1("Recovery: Ending transaction on backup volume %u ...", backupId);
+                AFSVolEndTrans(fromconn, fromtid, &rcode);
+				VDONE;
+            }
+            else
+            {
+                VPRINT1
+                    ("Recovery: Unable to start transaction on volume %u.\n",
+                    backupId);
+            }
+
+            /* delete source volume */
+            VPRINT1("Recovery: Creating transaction on source volume %u ...",
+                afromvol);
+            code =
+                AFSVolTransCreate(fromconn, afromvol, afrompart, ITBusy,
+                &fromtid);
+            VDONE;
+            if (!code)
+            {
+                AFSVolSetFlags(fromconn, fromtid,
+                    VTDeleteOnSalvage | VTOutOfService);
+                if (atoserver != afromserver)
+                    AFSVolSetForwarding(fromconn, fromtid, atoserver);
+                AFSVolDeleteVolume(fromconn, fromtid);
+                AFSVolEndTrans(fromconn, fromtid, &rcode);
+            }
+            else
+            {
+                VPRINT1
+                    ("Recovery: Unable to start transaction on volume %u.\n",
+                    afromvol);
+            }
+        }
     }
-    else {	/* yep, move complete */
-        if (pntg) {
-	    fprintf(STDOUT,
-		    "move complete - attempt cleanup of source partition - no guarantee\n");
-	    fflush(STDOUT);
-	}
-
-	/* delete backup volume */
-	if (fromconn) {
-	    code=AFSVolTransCreate (fromconn,backupId,afrompart, ITOffline,&fromtid);
-	    if (!code) {
-	        AFSVolSetFlags(fromconn,fromtid, VTDeleteOnSalvage | VTOutOfService);
-		AFSVolDeleteVolume(fromconn,fromtid);
-		AFSVolEndTrans(fromconn,fromtid,&rcode);
-	    }
-
-	    /* delete source volume */
-	    code=AFSVolTransCreate (fromconn, afromvol, afrompart, ITBusy, &fromtid);
-	    if (!code) {
-	        AFSVolSetFlags(fromconn,fromtid, VTDeleteOnSalvage | VTOutOfService);
-		if (atoserver != afromserver)
-		    AFSVolSetForwarding(fromconn,fromtid,atoserver);
-		AFSVolDeleteVolume(fromconn,fromtid);
-		AFSVolEndTrans(fromconn,fromtid,&rcode);
-	    }
-	}
-    }
 
     /* common cleanup - delete local clone */
-    if (newVol) {
-        code = AFSVolTransCreate (fromconn, newVol, afrompart, ITOffline, &clonetid);
-	if (!code) {
-	    AFSVolDeleteVolume(fromconn,clonetid);
-	    AFSVolEndTrans(fromconn,clonetid,&rcode);
-	}
+    if (newVol)
+    {
+        VPRINT1("Recovery: Creating transaction on clone volume %u ...",
+            newVol);
+        code =
+            AFSVolTransCreate(fromconn, newVol, afrompart, ITOffline,
+            &clonetid);
+        VDONE;
+        if (!code)
+        {
+            VPRINT1("Recovery: Deleting clone volume %u ...", newVol);
+            AFSVolDeleteVolume(fromconn, clonetid);
+            VDONE;
+
+            VPRINT1("Recovery: Ending transaction on clone volume %u ...",
+                newVol);
+            AFSVolEndTrans(fromconn, clonetid, &rcode);
+            VDONE;
+        }
+        else
+        {
+            VPRINT1("Recovery: Unable to start transaction on volume %u.\n",
+                newVol);
+        }
     }
 
     /* unlock VLDB entry */
-    ubik_Call (VL_ReleaseLock, cstruct, 0, afromvol, -1,
-	       (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
-
-done:	/* routine cleanup */
-    if (volName)  free(volName);
+    VPRINT1("Recovery: Releasing lock on VLDB entry for volume %u ...",
+        afromvol);
+    ubik_Call(VL_ReleaseLock, cstruct, 0, afromvol, -1,
+        (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
+    VDONE;
+
+  done:                        /* routine cleanup */
+    if (volName)
+        free(volName);
 #ifdef	ENABLE_BUGFIX_1165
-    if (infop)    free(infop);
+    if (infop)
+        free(infop);
 #endif
-    if (fromconn) rx_DestroyConnection(fromconn);
-    if (toconn)   rx_DestroyConnection(toconn);
+    if (fromconn)
+        rx_DestroyConnection(fromconn);
+    if (toconn)
+        rx_DestroyConnection(toconn);
 
-    if (pntg) {
-	fprintf(STDOUT,"cleanup complete - user verify desired result\n");
-	fflush(STDOUT);
+    if (pntg)
+    {
+        fprintf(STDOUT, "cleanup complete - user verify desired result\n");
+        fflush(STDOUT);
     }
     exit(1);
 }
+
 
 /* Make a new backup of volume <avolid> on <aserver> and <apart> 
  * if one already exists, update it 

--ikeVEW9yuYc//A+q--