vos: vos release -force-reclone option
[openafs.git] / src / volser / vsprocs.c
index 71870a1..18d47f3 100644 (file)
 #include <afs/procmgmt.h>      /* signal(), kill(), wait(), etc. */
 #include <roken.h>
 
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
 #ifdef AFS_AIX_ENV
 #include <sys/statfs.h>
 #endif
-#ifdef AFS_NT40_ENV
-#include <fcntl.h>
-#include <winsock2.h>
-#else
-#include <sys/file.h>
-#include <netinet/in.h>
-#endif
 
 #include <lock.h>
 #include <afs/voldefs.h>
 #include <rx/xdr.h>
 #include <rx/rx.h>
+#include <rx/rx_queue.h>
 #include <afs/vlserver.h>
 #include <afs/nfs.h>
 #include <afs/cellconfig.h>
@@ -51,7 +41,6 @@
 #endif
 #include <afs/vnode.h>
 #include <afs/volume.h>
-#include <errno.h>
 #define ERRCODE_RANGE 8                /* from error_table.h */
 #define        CLOCKSKEW   2           /* not really skew, but resolution */
 #define CLOCKADJ(x) (((x) < CLOCKSKEW) ? 0 : (x) - CLOCKSKEW)
@@ -65,7 +54,7 @@
 #include "vsutils_prototypes.h"
 #include "lockprocs_prototypes.h"
 
-struct ubik_client *cstruct;
+extern struct ubik_client *cstruct;
 int verbose = 0, noresolve = 0;
 
 struct release {
@@ -147,8 +136,6 @@ do { \
        { if (verbose) { fprintf(STDOUT, (es), (p1), (p2)); fflush(STDOUT); } }
 #define VPRINT3(es, p1, p2, p3) \
        { if (verbose) { fprintf(STDOUT, (es), (p1), (p2), (p3)); fflush(STDOUT); } }
-#define VPRINT4(es, p1, p2, p3, p4) \
-       { if (verbose) { fprintf(STDOUT, (es), (p1), (p2), (p3), (p4)); fflush(STDOUT); } }
 #define VDONE \
        { if (verbose) { fprintf(STDOUT, " done\n"); fflush(STDOUT); } }
 #define VEPRINT(es) \
@@ -177,28 +164,36 @@ static afs_int32 CheckAndDeleteVolume(struct rx_connection *aconn,
                                      afs_int32 apart, afs_uint32 okvol,
                                      afs_uint32 delvol);
 #endif
-static int DelVol(struct rx_connection *conn, afs_uint32 vid, afs_int32 part,
-                 afs_int32 flags);
-static int GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index,
+static int GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
                    struct rx_connection **connPtr, afs_int32 * transPtr,
                    afs_uint32 * crtimePtr, afs_uint32 * uptimePtr,
-                   afs_int32 *origflags);
+                   afs_int32 *origflags, afs_uint32 tmpVolId);
 static int SimulateForwardMultiple(struct rx_connection *fromconn,
                                   afs_int32 fromtid, afs_int32 fromdate,
                                   manyDests * tr, afs_int32 flags,
                                   void *cookie, manyResults * results);
+static int DoVolOnline(struct nvldbentry *vldbEntryPtr, afs_uint32 avolid,
+                      int index, char *vname, struct rx_connection *connPtr);
+static int DoVolClone(struct rx_connection *aconn, afs_uint32 avolid,
+                     afs_int32 apart, int type, afs_uint32 cloneid,
+                     char *typestring, char *pname, char *vname, char *suffix,
+                     struct volser_status *volstatus, afs_int32 *transPtr);
+static int DoVolDelete(struct rx_connection *aconn, afs_uint32 avolid,
+                      afs_int32 apart, char *typestring, afs_uint32 atoserver,
+                      struct volser_status *volstatus, char *pprefix);
 static afs_int32 CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver,
                             afs_int32 apart, afs_int32 * modentry,
-                            afs_uint32 * maxvolid, struct uvldbentry *aentry);
+                            afs_uint32 * maxvolid, struct nvldbentry *aentry);
+static afs_int32 VolumeExists(afs_uint32 server, afs_int32 partition,
+                              afs_uint32 volumeid);
+static afs_int32 CheckVldbRWBK(struct nvldbentry * entry,
+                               afs_int32 * modified);
+static afs_int32 CheckVldbRO(struct nvldbentry *entry, afs_int32 * modified);
+static afs_int32 CheckVldb(struct nvldbentry *entry, afs_int32 * modified,
+                           afs_int32 *deleted);
 static void dump_sig_handler(int x);
 static int sortVolumes(const void *a, const void *b);
-static afs_int32 CheckVldbRWBK(struct uvldbentry *entry,
-                              afs_int32 * modified);
-static int CheckVldbRO(struct uvldbentry *entry, afs_int32 * modified);
-static afs_int32 CheckVldb(struct uvldbentry *entry, afs_int32 * modified,
-                           afs_int32 *deleted);
-static afs_int32 VolumeExists(afs_uint32 server, afs_int32 partition,
-                             afs_uint32 volumeid);
+
 
 /*map the partition <partId> into partition name <partName>*/
 void
@@ -399,11 +394,9 @@ PrintError(char *msg, afs_int32 errcode)
        break;
     default:
        {
-           initialize_KA_error_table();
            initialize_RXK_error_table();
            initialize_KTC_error_table();
            initialize_ACFG_error_table();
-           initialize_CMD_error_table();
            initialize_VL_error_table();
 
            fprintf(STDERR, "%s: %s\n", afs_error_table_name(errcode),
@@ -414,8 +407,7 @@ PrintError(char *msg, afs_int32 errcode)
     return 0;
 }
 
-void
-init_volintInfo(struct volintInfo *vinfo) {
+void init_volintInfo(struct volintInfo *vinfo) {
     memset(vinfo, 0, sizeof(struct volintInfo));
 
     vinfo->maxquota = -1;
@@ -546,88 +538,7 @@ CheckAndDeleteVolume(struct rx_connection *aconn, afs_int32 apart,
 
 #endif
 
-/* called by EnumerateEntryU, show vldb entry in a reasonable format */
-void
-SubEnumerateEntryU(struct uvldbentry *entry)
-{
-    int i;
-    char pname[10];
-    int isMixed = 0;
-    char hoststr[16];
-
-#ifdef notdef
-    fprintf(STDOUT, "  readWriteID %-10u ", entry->volumeId[RWVOL]);
-    if (entry->flags & RW_EXISTS)
-       fprintf(STDOUT, " valid \n");
-    else
-       fprintf(STDOUT, " invalid \n");
-    fprintf(STDOUT, "  readOnlyID  %-10u ", entry->volumeId[ROVOL]);
-    if (entry->flags & RO_EXISTS)
-       fprintf(STDOUT, " valid \n");
-    else
-       fprintf(STDOUT, " invalid \n");
-    fprintf(STDOUT, "  backUpID    %-10u ", entry->volumeId[BACKVOL]);
-    if (entry->flags & BACK_EXISTS)
-       fprintf(STDOUT, " valid \n");
-    else
-       fprintf(STDOUT, " invalid \n");
-    if ((entry->cloneId != 0) && (entry->flags & RO_EXISTS))
-       fprintf(STDOUT, "    releaseClone %-10u \n", entry->cloneId);
-#else
-    if (entry->flags & RW_EXISTS)
-       fprintf(STDOUT, "    RWrite: %-10u", entry->volumeId[RWVOL]);
-    if (entry->flags & RO_EXISTS)
-       fprintf(STDOUT, "    ROnly: %-10u", entry->volumeId[ROVOL]);
-    if (entry->flags & BACK_EXISTS)
-       fprintf(STDOUT, "    Backup: %-10u", entry->volumeId[BACKVOL]);
-    if ((entry->cloneId != 0) && (entry->flags & RO_EXISTS))
-       fprintf(STDOUT, "    RClone: %-10lu", (unsigned long)entry->cloneId);
-    fprintf(STDOUT, "\n");
-#endif
-    fprintf(STDOUT, "    number of sites -> %lu\n",
-           (unsigned long)entry->nServers);
-    for (i = 0; i < entry->nServers; i++) {
-       if (entry->serverFlags[i] & NEW_REPSITE)
-           isMixed = 1;
-    }
-    for (i = 0; i < entry->nServers; i++) {
-       MapPartIdIntoName(entry->serverPartition[i], pname);
-       fprintf(STDOUT, "       server %s partition %s ",
-               noresolve ? afs_inet_ntoa_r(entry->serverUnique[i], hoststr) :
-                hostutil_GetNameByINet(entry->serverUnique[i]), pname);
-       if (entry->serverFlags[i] & ITSRWVOL)
-           fprintf(STDOUT, "RW Site ");
-       else
-           fprintf(STDOUT, "RO Site ");
-       if (isMixed) {
-           if (entry->serverFlags[i] & NEW_REPSITE)
-               fprintf(STDOUT," -- New release");
-           else
-               if (!(entry->serverFlags[i] & ITSRWVOL))
-                   fprintf(STDOUT," -- Old release");
-       } else {
-           if (entry->serverFlags[i] & RO_DONTUSE)
-               fprintf(STDOUT, " -- Not released");
-       }
-       fprintf(STDOUT, "\n");
-    }
-
-    return;
-
-}
-
-/*enumerate the vldb entry corresponding to <entry> */
-void
-EnumerateEntryU(struct uvldbentry *entry)
-{
-
-    fprintf(STDOUT, "\n");
-    fprintf(STDOUT, "%s \n", entry->name);
-    SubEnumerateEntryU(entry);
-    return;
-}
-
-/* called by EnumerateEntry, show vldb entry in a reasonable format */
+/* called by EmuerateEntry, show vldb entry in a reasonable format */
 void
 SubEnumerateEntry(struct nvldbentry *entry)
 {
@@ -732,12 +643,10 @@ UV_PartitionInfo64(afs_uint32 server, char *pname,
     struct rx_connection *aconn;
     afs_int32 code = 0;
 
-    aconn = (struct rx_connection *)0;
     aconn = UV_Bind(server, AFSCONF_VOLUMEPORT);
     code = AFSVolPartitionInfo64(aconn, pname, partition);
     if (code == RXGEN_OPCODE) {
-       struct diskPartition *dpp =
-           (struct diskPartition *)malloc(sizeof(struct diskPartition));
+       struct diskPartition *dpp = malloc(sizeof(struct diskPartition));
        code = AFSVolPartitionInfo(aconn, pname, dpp);
        if (!code) {
            strncpy(partition->name, dpp->name, 32);
@@ -808,11 +717,10 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname,
     afs_int32 error;
     afs_int32 rcode, vcode;
     afs_int32 lastid;
-    struct uvldbentry entry, storeEntry;       /*the new vldb entry */
+    struct nvldbentry entry, storeEntry;       /*the new vldb entry */
     struct volintInfo tstatus;
 
     tid = 0;
-    aconn = (struct rx_connection *)0;
     error = 0;
 
     init_volintInfo(&tstatus);
@@ -828,7 +736,7 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname,
     }
 
     if (*anewid) {
-        vcode = VLDB_GetEntryByIDU(*anewid, -1, &entry);
+        vcode = VLDB_GetEntryByID(*anewid, -1, &entry);
        if (!vcode) {
            fprintf(STDERR, "Volume ID %d already exists\n", *anewid);
            return VVOLEXISTS;
@@ -852,6 +760,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;
     }
@@ -877,7 +791,7 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname,
     /* set up the vldb entry for this volume */
     strncpy(entry.name, aname, VOLSER_OLDMAXVOLNAME);
     entry.nServers = 1;
-    entry.serverUnique[0] = aserver;   /* this should have another
+    entry.serverNumber[0] = aserver;   /* this should have another
                                         * level of indirection later */
     entry.serverPartition[0] = apart;  /* this should also have
                                         * another indirection level */
@@ -889,9 +803,9 @@ UV_CreateVolume3(afs_uint32 aserver, afs_int32 apart, char *aname,
     entry.cloneId = 0;
     /*map into right byte order, before passing to xdr, the stuff has to be in host
      * byte order. Xdr converts it into network order */
-    MapNetworkToHostU(&entry, &storeEntry);
+    MapNetworkToHost(&entry, &storeEntry);
     /* create the vldb entry */
-    vcode = VLDB_CreateEntryU(&storeEntry);
+    vcode = VLDB_CreateEntry(&storeEntry);
     if (vcode) {
        fprintf(STDERR,
                "Could not create a VLDB entry for the volume %s %lu\n",
@@ -937,7 +851,7 @@ UV_AddVLDBEntry(afs_uint32 aserver, afs_int32 apart, char *aname,
     struct rx_connection *aconn;
     afs_int32 error;
     afs_int32 vcode;
-    struct uvldbentry entry, storeEntry;       /*the new vldb entry */
+    struct nvldbentry entry, storeEntry;       /*the new vldb entry */
 
     aconn = (struct rx_connection *)0;
     error = 0;
@@ -945,7 +859,7 @@ UV_AddVLDBEntry(afs_uint32 aserver, afs_int32 apart, char *aname,
     /* set up the vldb entry for this volume */
     strncpy(entry.name, aname, VOLSER_OLDMAXVOLNAME);
     entry.nServers = 1;
-    entry.serverUnique[0] = aserver;   /* this should have another
+    entry.serverNumber[0] = aserver;   /* this should have another
                                         * level of indirection later */
     entry.serverPartition[0] = apart;  /* this should also have
                                         * another indirection level */
@@ -962,9 +876,9 @@ UV_AddVLDBEntry(afs_uint32 aserver, afs_int32 apart, char *aname,
     entry.cloneId = 0;
     /*map into right byte order, before passing to xdr, the stuff has to be in host
      * byte order. Xdr converts it into network order */
-    MapNetworkToHostU(&entry, &storeEntry);
+    MapNetworkToHost(&entry, &storeEntry);
     /* create the vldb entry */
-    vcode = VLDB_CreateEntryU(&storeEntry);
+    vcode = VLDB_CreateEntry(&storeEntry);
     if (vcode) {
        fprintf(STDERR,
                "Could not create a VLDB entry for the  volume %s %lu\n",
@@ -992,7 +906,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
     afs_int32 ttid = 0;
     afs_int32 code, rcode;
     afs_int32 error = 0;
-    struct uvldbentry entry, storeEntry;
+    struct nvldbentry entry, storeEntry;
     int islocked = 0;
     afs_int32 avoltype = -1, vtype;
     int notondisk = 0, notinvldb = 0;
@@ -1008,37 +922,26 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
     } else {
        islocked = 1;
 
-       code = VLDB_GetEntryByIDU(avolid, avoltype, &entry);
+       code = VLDB_GetEntryByID(avolid, avoltype, &entry);
        EGOTO1(error_exit, code, "Could not fetch VLDB entry for volume %u\n",
               avolid);
-       MapHostToNetworkU(&entry);
+       MapHostToNetwork(&entry);
 
        if (verbose)
-           EnumerateEntryU(&entry);
+           EnumerateEntry(&entry);
     }
 
     /* Whether volume is in the VLDB or not. Delete the volume on disk */
     aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
-    code = AFSVolTransCreate_retry(aconn, avolid, apart, ITOffline, &ttid);
+
+    code = DoVolDelete(aconn, avolid, apart, "the", 0, NULL, NULL);
     if (code) {
-       if (code == VNOVOL) {
+       if (code == VNOVOL)
            notondisk = 1;
-       } else {
-           EGOTO1(error_exit, code, "Transaction on volume %u failed\n",
-                  avolid);
+       else {
+           error = code;
+           goto error_exit;
        }
-    } else {
-       VPRINT1("Trying to delete the volume %u ...", avolid);
-
-       code = AFSVolDeleteVolume(aconn, ttid);
-       EGOTO1(error_exit, code, "Could not delete the volume %u \n", avolid);
-
-       code = AFSVolEndTrans(aconn, ttid, &rcode);
-       code = (code ? code : rcode);
-       ttid = 0;
-       EGOTO1(error_exit, code,
-              "Could not end the transaction for the volume %u \n", avolid);
-       VDONE;
     }
 
     /* Now update the VLDB entry.
@@ -1052,7 +955,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
        /* Its a backup volume, modify the VLDB entry. Check that the
         * backup volume is on the server/partition we asked to delete.
         */
-       if (!(entry.flags & BACK_EXISTS) || !Lp_MatchU(aserver, apart, &entry)) {
+       if (!(entry.flags & BACK_EXISTS) || !Lp_Match(aserver, apart, &entry)) {
            notinvldb = 2;      /* Not on this server and partition */
            ERROR_EXIT(0);
        }
@@ -1069,7 +972,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
         * If flags does not have RO_EIXSTS set, then this may mean the RO
         * hasn't been released (and could exist in VLDB).
         */
-       if (!Lp_ROMatchU(aserver, apart, &entry)) {
+       if (!Lp_ROMatch(aserver, apart, &entry)) {
            notinvldb = 2;      /* Not found on this server and partition */
            ERROR_EXIT(0);
        }
@@ -1079,9 +982,9 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
                    "Marking the readonly volume %lu deleted in the VLDB\n",
                    (unsigned long)avolid);
 
-       Lp_SetROValueU(&entry, aserver, apart, 0, 0);   /* delete the site */
+       Lp_SetROValue(&entry, aserver, apart, 0, 0);    /* delete the site */
        entry.nServers--;
-       if (!Lp_ROMatchU(0, 0, &entry))
+       if (!Lp_ROMatch(0, 0, &entry))
            entry.flags &= ~RO_EXISTS;  /* This was the last ro volume */
        vtype = ROVOL;
     }
@@ -1091,34 +994,19 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
         * Check that the readwrite volumes is on the server/partition we
         * asked to delete.
         */
-       if (!(entry.flags & RW_EXISTS) || !Lp_MatchU(aserver, apart, &entry)) {
+       if (!(entry.flags & RW_EXISTS) || !Lp_Match(aserver, apart, &entry)) {
            notinvldb = 2;      /* Not found on this server and partition */
            ERROR_EXIT(0);
        }
 
-       /* Delete backup if it exists */
-       code =
-           AFSVolTransCreate_retry(aconn, entry.volumeId[BACKVOL], apart,
-                                   ITOffline, &ttid);
-
-       if (!code) {
-           if (verbose) {
-               fprintf(STDOUT, "Trying to delete the backup volume %u ...",
-                       entry.volumeId[BACKVOL]);
-               fflush(STDOUT);
+       if (entry.volumeId[BACKVOL]) {
+           /* Delete backup if it exists */
+           code = DoVolDelete(aconn, entry.volumeId[BACKVOL], apart,
+                              "the backup", 0, NULL, NULL);
+           if (code && code != VNOVOL) {
+               error = code;
+               goto error_exit;
            }
-           code = AFSVolDeleteVolume(aconn, ttid);
-           EGOTO1(error_exit, code, "Could not delete the volume %u \n",
-                  entry.volumeId[BACKVOL]);
-
-           code = AFSVolEndTrans(aconn, ttid, &rcode);
-           ttid = 0;
-           code = (code ? code : rcode);
-           EGOTO1(error_exit, code,
-                  "Could not end the transaction for the volume %u \n",
-                  entry.volumeId[BACKVOL]);
-           if (verbose)
-               fprintf(STDOUT, " done\n");
        }
 
        if (verbose)
@@ -1129,7 +1017,7 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
                      flags & BACK_EXISTS) ? ", and its backup volume," :
                     ""));
 
-       Lp_SetRWValueU(&entry, aserver, apart, 0L, 0L);
+       Lp_SetRWValue(&entry, aserver, apart, 0L, 0L);
        entry.nServers--;
        entry.flags &= ~(BACK_EXISTS | RW_EXISTS);
        vtype = RWVOL;
@@ -1154,9 +1042,9 @@ UV_DeleteVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
               "Could not delete the VLDB entry for the volume %u \n",
               avolid);
     } else {
-       MapNetworkToHostU(&entry, &storeEntry);
+       MapNetworkToHost(&entry, &storeEntry);
        code =
-           VLDB_ReplaceEntryU(avolid, vtype, &storeEntry,
+           VLDB_ReplaceEntry(avolid, vtype, &storeEntry,
                              (LOCKREL_OPCODE | LOCKREL_AFSID |
                               LOCKREL_TIMESTAMP));
        EGOTO1(error_exit, code,
@@ -1257,6 +1145,352 @@ sigint_handler(int x)
     (void)signal(SIGINT, sigint_handler);
 }
 
+static int
+DoVolDelete(struct rx_connection *aconn, afs_uint32 avolid,
+           afs_int32 apart, char *ptypestring, afs_uint32 atoserver,
+           struct volser_status *volstatus, char *pprefix)
+{
+    afs_int32 ttid = 0, code, rcode, error = 0;
+    char *prefix, *typestring;
+    int beverbose = 0;
+
+    if (pprefix)
+       prefix = pprefix;
+    else
+       prefix = "";
+
+    if (ptypestring) {
+       typestring = ptypestring;
+       beverbose = 1;
+    } else
+       typestring = "the";
+
+    if (beverbose)
+       VPRINT3("%sDeleting %s volume %u ...", prefix, typestring, avolid);
+
+    code =
+       AFSVolTransCreate_retry(aconn, avolid, apart, ITOffline, &ttid);
+
+    /* return early and quietly for VNOVOL; don't continue the attempt to delete. */
+    if (code == VNOVOL) {
+       error = code;
+       goto dfail;
+    }
+
+    EGOTO2(dfail, code, "%sFailed to start transaction on %u\n",
+          prefix, avolid);
+
+    if (volstatus) {
+       code = AFSVolGetStatus(aconn, ttid, volstatus);
+       EGOTO2(dfail, code, "%sCould not get timestamp from volume %u\n",
+              prefix, avolid);
+    }
+
+    code =
+       AFSVolSetFlags(aconn, ttid,
+                      VTDeleteOnSalvage | VTOutOfService);
+
+    EGOTO2(dfail, code, "%sCould not set flags on volume %u \n",
+          prefix, avolid);
+
+    if (atoserver) {
+       VPRINT1("%sSetting volume forwarding pointer ...", prefix);
+       AFSVolSetForwarding(aconn, ttid, atoserver);
+       VDONE;
+    }
+
+    code = AFSVolDeleteVolume(aconn, ttid);
+    EGOTO2(dfail, code, "%sCould not delete volume %u\n", prefix, avolid);
+
+dfail:
+    if (ttid) {
+        code = AFSVolEndTrans(aconn, ttid, &rcode);
+       ttid = 0;
+        if (!code)
+            code = rcode;
+        if (code) {
+            fprintf(STDERR, "%sCould not end transaction on %s volume %lu \n",
+                    prefix, typestring, (unsigned long)avolid);
+            if (!error)
+                error = code;
+        }
+    }
+
+    if (beverbose && !error)
+       VDONE;
+    return error;
+}
+
+static int
+DoVolClone(struct rx_connection *aconn, afs_uint32 avolid,
+          afs_int32 apart, int type, afs_uint32 cloneid,
+          char *typestring, char *pname, char *vname, char *suffix,
+          struct volser_status *volstatus, afs_int32 *transPtr)
+{
+    char cname[64];
+    afs_int32 ttid = 0, btid = 0;
+    afs_int32 code = 0, rcode = 0;
+    afs_int32 error = 0;
+    int cloneexists = 1;
+
+    /* Test to see if the clone volume exists by trying to create
+     * a transaction on the clone volume. We've assumed the clone exists.
+     */
+    code = AFSVolTransCreate_retry(aconn, cloneid, apart, ITOffline, &btid);
+    if (code) {
+        if (code != VNOVOL) {
+           EPRINT2(code, "Could not reach the %s volume %lu\n",
+                    typestring, (unsigned long)cloneid);
+            error = code;
+            goto cfail;
+        }
+        cloneexists = 0;         /* clone volume does not exist */
+    }
+    if (btid) {
+        code = AFSVolEndTrans(aconn, btid, &rcode);
+        btid = 0;
+        if (code || rcode) {
+            fprintf(STDERR,
+                    "Could not end transaction on the previous %s volume %lu\n",
+                    typestring, (unsigned long)cloneid);
+            error = (code ? code : rcode);
+            goto cfail;
+        }
+    }
+
+    /* Now go ahead and try to clone the RW volume.
+     * First start a transaction on the RW volume
+     */
+    code = AFSVolTransCreate_retry(aconn, avolid, apart, ITBusy, &ttid);
+    if (code) {
+        fprintf(STDERR, "Could not start a transaction on the volume %lu\n",
+                (unsigned long)avolid);
+        error = code;
+        goto cfail;
+    }
+
+    /* Clone or reclone the volume, depending on whether the clone
+     * volume exists or not
+     */
+    if (cloneexists) {
+        VPRINT2("Re-cloning %s volume %u ...", typestring, cloneid);
+
+        code = AFSVolReClone(aconn, ttid, cloneid);
+        if (code) {
+            EPRINT2(code, "Could not re-clone %s volume %lu\n",
+                    typestring, (unsigned long)cloneid);
+            error = code;
+            goto cfail;
+        }
+    } else {
+        VPRINT2("Creating a new %s clone %u ...", typestring, cloneid);
+
+       if (!vname) {
+           strcpy(cname, pname);
+           strcat(cname, suffix);
+       }
+
+        code = AFSVolClone(aconn, ttid, 0, type, vname?vname:cname,
+                          &cloneid);
+        if (code) {
+            fprintf(STDERR, "Failed to clone the volume %lu\n",
+                    (unsigned long)avolid);
+            error = code;
+            goto cfail;
+        }
+    }
+
+    VDONE;
+
+    if (volstatus) {
+       VPRINT1("Getting status of parent volume %u...", avolid);
+       code = AFSVolGetStatus(aconn, ttid, volstatus);
+       if (code) {
+           fprintf(STDERR, "Failed to get the status of the parent volume %lu\n",
+                   (unsigned long)avolid);
+           error = code;
+            goto cfail;
+       }
+       VDONE;
+    }
+
+cfail:
+    if (ttid) {
+        code = AFSVolEndTrans(aconn, ttid, &rcode);
+        if (code || rcode) {
+            fprintf(STDERR, "Could not end transaction on the volume %lu\n",
+                    (unsigned long)avolid);
+            if (!error)
+                error = (code ? code : rcode);
+        }
+    }
+
+    if (btid) {
+        code = AFSVolEndTrans(aconn, btid, &rcode);
+        if (code || rcode) {
+            fprintf(STDERR,
+                    "Could not end transaction on the %s volume %lu\n",
+                    typestring, (unsigned long)cloneid);
+            if (!error)
+                error = (code ? code : rcode);
+        }
+    }
+    return error;
+}
+
+/* Convert volume from RO to RW; adjust the VLDB entry to match.
+ * The nvldbentry passed to us has already been MapHostToNetwork'd
+ * by the caller.
+ */
+
+int
+UV_ConvertRO(afs_uint32 server, afs_uint32 partition, afs_uint32 volid,
+               struct nvldbentry *entry)
+{
+    afs_int32 code, i, same;
+    struct nvldbentry checkEntry, storeEntry;
+    afs_int32 vcode;
+    afs_int32 rwindex = 0;
+    afs_uint32 rwserver = 0;
+    afs_int32 roindex = 0;
+    afs_uint32 roserver = 0;
+    struct rx_connection *aconn;
+
+    vcode =
+       ubik_VL_SetLock(cstruct, 0, entry->volumeId[RWVOL], RWVOL,
+                 VLOP_MOVE);
+    if (vcode) {
+       fprintf(STDERR,
+               "Unable to lock volume %lu, code %d\n",
+               (unsigned long)entry->volumeId[RWVOL],vcode);
+       PrintError("", vcode);
+       return -1;
+    }
+
+    /* make sure the VLDB entry hasn't changed since we started */
+    memset(&checkEntry, 0, sizeof(checkEntry));
+    vcode = VLDB_GetEntryByID(volid, -1, &checkEntry);
+    if (vcode) {
+       fprintf(STDERR,
+                "Could not fetch the entry for volume %lu from VLDB\n",
+                (unsigned long)volid);
+       PrintError("convertROtoRW ", vcode);
+       code = vcode;
+       goto error_exit;
+    }
+
+    MapHostToNetwork(&checkEntry);
+    entry->flags &= ~VLOP_ALLOPERS;  /* clear any stale lock operation flags */
+    entry->flags |= VLOP_MOVE;        /* set to match SetLock operation above */
+    if (memcmp(entry, &checkEntry, sizeof(*entry)) != 0) {
+        fprintf(STDERR,
+                "VLDB entry for volume %lu has changed; please reissue the command.\n",
+                (unsigned long)volid);
+        code = -1;
+        goto error_exit;
+    }
+
+    /* extract information from the original entry */
+    for (i = 0; i < entry->nServers; i++) {
+       if (entry->serverFlags[i] & ITSRWVOL) {
+           rwindex = i;
+           rwserver = entry->serverNumber[i];
+       /*  rwpartition = entry->serverPartition[i]; */
+           if (roserver)
+               break;
+       } else if ((entry->serverFlags[i] & ITSROVOL) && !roserver) {
+           same = VLDB_IsSameAddrs(server, entry->serverNumber[i], &code);
+           if (code) {
+               fprintf(STDERR,
+                       "Failed to get info about server's %d address(es) from vlserver (err=%d); aborting call!\n",
+                       server, code);
+               code = ENOENT;
+               goto error_exit;
+           }
+           if (same) {
+               roindex = i;
+               roserver = entry->serverNumber[i];
+       /*      ropartition = entry->serverPartition[i]; */
+               if (rwserver)
+                    break;
+           }
+       }
+    }
+
+    aconn = UV_Bind(server, AFSCONF_VOLUMEPORT);
+    code = AFSVolConvertROtoRWvolume(aconn, partition, volid);
+    if (code) {
+       fprintf(STDERR,
+               "Converting RO volume %lu to RW volume failed with code %d\n",
+               (unsigned long)volid, code);
+       PrintError("convertROtoRW ", code);
+       goto error_exit;
+    }
+    /* Update the VLDB to match what we did on disk as much as possible.  */
+    /* If the converted RO was in the VLDB, make it look like the new RW. */
+    if (roserver) {
+       entry->serverFlags[roindex] = ITSRWVOL;
+    } else {
+       /* Add a new site entry for the newly created RW.  It's possible
+        * (but unlikely) that we are already at MAXNSERVERS and that this
+        * new site will invalidate the whole VLDB entry;  however,
+        * VLDB_ReplaceEntry will detect this and return VL_BADSERVER,
+        * so we need no extra guard logic here.
+        */
+       afs_int32 newrwindex = entry->nServers;
+       (entry->nServers)++;
+       entry->serverNumber[newrwindex] = server;
+       entry->serverPartition[newrwindex] = partition;
+       entry->serverFlags[newrwindex] = ITSRWVOL;
+    }
+    entry->flags |= RW_EXISTS;
+    entry->flags &= ~BACK_EXISTS;
+
+    /* if the old RW was in the VLDB, remove it by decrementing the number */
+    /* of servers, replacing the RW entry with the last entry, and zeroing */
+    /* out the last entry. */
+    if (rwserver) {
+       (entry->nServers)--;
+       if (rwindex != entry->nServers) {
+           entry->serverNumber[rwindex] = entry->serverNumber[entry->nServers];
+           entry->serverPartition[rwindex] =
+               entry->serverPartition[entry->nServers];
+           entry->serverFlags[rwindex] = entry->serverFlags[entry->nServers];
+           entry->serverNumber[entry->nServers] = 0;
+           entry->serverPartition[entry->nServers] = 0;
+           entry->serverFlags[entry->nServers] = 0;
+       }
+    }
+    entry->flags &= ~RO_EXISTS;
+    for (i = 0; i < entry->nServers; i++) {
+       if (entry->serverFlags[i] & ITSROVOL) {
+           if (!(entry->serverFlags[i] & (RO_DONTUSE | NEW_REPSITE)))
+               entry->flags |= RO_EXISTS;
+       }
+    }
+    MapNetworkToHost(entry, &storeEntry);
+    code =
+       VLDB_ReplaceEntry(entry->volumeId[RWVOL], RWVOL, &storeEntry,
+                         (LOCKREL_OPCODE | LOCKREL_AFSID |
+                          LOCKREL_TIMESTAMP));
+    if (code) {
+       fprintf(STDERR,
+               "Warning: volume converted, but vldb update failed with code %d!\n",
+               code);
+    }
+
+  error_exit:
+    vcode = UV_LockRelease(entry->volumeId[RWVOL]);
+    if (vcode) {
+       fprintf(STDERR,
+               "Unable to unlock volume %lu, code %d\n",
+               (unsigned long)entry->volumeId[RWVOL],vcode);
+       PrintError("", vcode);
+    }
+    return code;
+}
+
+
 /* Move volume <afromvol> on <afromserver> <afrompart> to <atoserver>
  * <atopart>.  The operation is almost idempotent.  The following
  * flags are recognized:
@@ -1293,7 +1527,7 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
     struct volser_status tstatus;
     struct destServer destination;
 
-    struct uvldbentry entry, storeEntry;
+    struct nvldbentry entry, storeEntry;
     int i;
     afs_int32 error;
     char in, lf;               /* for test code */
@@ -1341,7 +1575,7 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
        /* or drop through */
     }
 
-    vcode = VLDB_GetEntryByIDU(afromvol, -1, &entry);
+    vcode = VLDB_GetEntryByID(afromvol, -1, &entry);
     EGOTO1(mfail, vcode,
           "Could not fetch the entry for the volume  %u from the VLDB \n",
           afromvol);
@@ -1355,17 +1589,17 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
     EGOTO1(mfail, vcode, "Could not lock entry for volume %u \n", afromvol);
     islocked = 1;
 
-    vcode = VLDB_GetEntryByIDU(afromvol, RWVOL, &entry);
+    vcode = VLDB_GetEntryByID(afromvol, RWVOL, &entry);
     EGOTO1(mfail, vcode,
           "Could not fetch the entry for the volume  %u from the VLDB \n",
           afromvol);
 
     backupId = entry.volumeId[BACKVOL];
-    MapHostToNetworkU(&entry);
+    MapHostToNetwork(&entry);
 
-    if (!Lp_MatchU(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_MatchU(atoserver, atopart, &entry)) {
+       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 %lu is not on the specified site. \n",
                    (unsigned long)afromvol);
@@ -1375,8 +1609,8 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
                    char pname[10];
                    MapPartIdIntoName(entry.serverPartition[i], pname);
                    fprintf(STDERR, " server %s partition %s \n",
-                           noresolve ? afs_inet_ntoa_r(entry.serverUnique[i], hoststr) :
-                            hostutil_GetNameByINet(entry.serverUnique[i]),
+                           noresolve ? afs_inet_ntoa_r(entry.serverNumber[i], hoststr) :
+                            hostutil_GetNameByINet(entry.serverNumber[i]),
                            pname);
                }
            }
@@ -1397,79 +1631,20 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
         * may still be existing physically on from fileserver
         */
        fromconn = UV_Bind(afromserver, AFSCONF_VOLUMEPORT);
-       fromtid = 0;
        pntg = 1;
 
-       tmp = fromtid;
-       code =
-           AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITOffline,
-                                   &tmp);
-       fromtid = tmp;
-
-       if (!code) {            /* volume exists - delete it */
-           VPRINT1("Setting flags on leftover source volume %u ...",
-                   afromvol);
-           code =
-               AFSVolSetFlags(fromconn, fromtid,
-                              VTDeleteOnSalvage | VTOutOfService);
-           EGOTO1(mfail, 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);
-           EGOTO1(mfail, 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;
-           EGOTO1(mfail, code,
-                  "Could not end the transaction for the leftover source volume %u \n",
-                  afromvol);
-           VDONE;
+       code = DoVolDelete(fromconn, afromvol, afrompart,
+                          "leftover", 0, NULL, NULL);
+       if (code && code != VNOVOL) {
+           error = code;
+           goto mfail;
        }
 
-       /*delete the backup volume now */
-       fromtid = 0;
-       code =
-           AFSVolTransCreate_retry(fromconn, backupId, afrompart, ITOffline,
-                                   &tmp);
-       fromtid = tmp;
-
-       if (!code) {            /* backup volume exists - delete it */
-           VPRINT1("Setting flags on leftover backup volume %u ...",
-                   backupId);
-           code =
-               AFSVolSetFlags(fromconn, fromtid,
-                              VTDeleteOnSalvage | VTOutOfService);
-           EGOTO1(mfail, code,
-                  "Failed to set flags on the backup volume %u\n", backupId);
-           VDONE;
-
-           VPRINT1("Deleting leftover backup volume %u ...", backupId);
-           code = AFSVolDeleteVolume(fromconn, fromtid);
-           EGOTO1(mfail, 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;
-           EGOTO1(mfail, code,
-                  "Could not end the transaction for the leftover backup volume %u\n",
-                  backupId);
-           VDONE;
+       code = DoVolDelete(fromconn, backupId, afrompart,
+                          "leftover backup", 0, NULL, NULL);
+       if (code && code != VNOVOL) {
+           error = code;
+           goto mfail;
        }
 
        fromtid = 0;
@@ -1497,7 +1672,7 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
     pntg = 1;
     toconn = UV_Bind(atoserver, AFSCONF_VOLUMEPORT);   /* get connections to the servers */
     fromconn = UV_Bind(afromserver, AFSCONF_VOLUMEPORT);
-    fromtid = totid = 0;       /* initialize to uncreated */
+    totid = 0; /* initialize to uncreated */
 
     /* ***
      * clone the read/write volume locally.
@@ -1514,7 +1689,7 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
        /* Get a clone id */
        VPRINT1("Allocating new volume id for clone of volume %u ...",
                afromvol);
-       newVol = tmpVol = 0;
+       tmpVol = 0;
        vcode = ubik_VL_GetNewVolumeId(cstruct, 0, 1, &tmpVol);
        newVol = tmpVol;
        EGOTO1(mfail, vcode,
@@ -1611,33 +1786,11 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
 
     /* create a volume on the target machine */
     volid = afromvol;
-    tmp = totid;
-    code = AFSVolTransCreate_retry(toconn, volid, atopart, ITOffline, &tmp);
-    totid = tmp;
-    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);
-       EGOTO1(mfail, 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;
-       EGOTO1(mfail, code,
-              "Could not end the transaction on pre-existing volume %u on destination\n",
-              volid);
-       VDONE;
+    code = DoVolDelete(toconn, volid, atopart,
+                      "pre-existing destination", 0, NULL, NULL);
+    if (code && code != VNOVOL) {
+       error = code;
+       goto mfail;
     }
 
     VPRINT1("Creating the destination volume %u ...", volid);
@@ -1756,8 +1909,8 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
           afromvol);
     VDONE;
 
-    Lp_SetRWValueU(&entry, afromserver, afrompart, atoserver, atopart);
-    MapNetworkToHostU(&entry, &storeEntry);
+    Lp_SetRWValue(&entry, afromserver, afrompart, atoserver, atopart);
+    MapNetworkToHost(&entry, &storeEntry);
     storeEntry.flags &= ~BACK_EXISTS;
 
     if (TESTC) {
@@ -1780,7 +1933,7 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
 
     VPRINT1("Releasing lock on VLDB entry for volume %u ...", afromvol);
     vcode =
-       VLDB_ReplaceEntryU(afromvol, -1, &storeEntry,
+       VLDB_ReplaceEntry(afromvol, -1, &storeEntry,
                          (LOCKREL_OPCODE | LOCKREL_AFSID |
                           LOCKREL_TIMESTAMP));
     if (vcode) {
@@ -1852,73 +2005,26 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
           afromvol);
     VDONE;
 
-    /* Delete the backup volume on the original site */
-    VPRINT1("Creating transaction for backup volume %u on source ...",
-           backupId);
-    tmp = fromtid;
-    code =
-       AFSVolTransCreate_retry(fromconn, backupId, afrompart, ITOffline, &tmp);
-    fromtid = tmp;
-    VDONE;
-    if (!code) {
-       VPRINT1("Setting flags on backup volume %u on source ...", backupId);
-       code =
-           AFSVolSetFlags(fromconn, fromtid,
-                          VTDeleteOnSalvage | VTOutOfService);
-       EGOTO1(mfail, code,
-              "Failed to set the flags on the backup volume %u on the source\n",
-              backupId);
-       VDONE;
-
-       VPRINT1("Deleting the backup volume %u on the source ...", backupId);
-       code = AFSVolDeleteVolume(fromconn, fromtid);
-       EGOTO1(mfail, code,
-              "Failed to delete the backup volume %u on the source\n",
-              backupId);
-       VDONE;
+    code = DoVolDelete(fromconn, backupId, afrompart,
+                      "source backup", 0, NULL, NULL);
+    if (code && code != VNOVOL) {
+       error = code;
+       goto mfail;
+    }
 
-       VPRINT1("Ending transaction on backup volume %u on source ...",
-               backupId);
-       code = AFSVolEndTrans(fromconn, fromtid, &rcode);
-       fromtid = 0;
-       if (!code)
-           code = rcode;
-       EGOTO1(mfail, code,
-              "Failed to end the transaction on the backup volume %u on the source\n",
-              backupId);
-       VDONE;
-    } else
-       code = 0;               /* no backup volume? that's okay */
+    code = 0;          /* no backup volume? that's okay */
 
     fromtid = 0;
     if (!(flags & RV_NOCLONE)) {
-       VPRINT1("Starting transaction on the cloned volume %u ...", newVol);
-       tmp = clonetid;
-       code =
-           AFSVolTransCreate_retry(fromconn, newVol, afrompart, ITOffline,
-                             &tmp);
-       clonetid = tmp;
-       EGOTO1(mfail, code,
-              "Failed to start a transaction on the cloned volume%u\n",
-              newVol);
-       VDONE;
-
-       /* now delete the clone */
-       VPRINT1("Deleting the cloned volume %u ...", newVol);
-       code = AFSVolDeleteVolume(fromconn, clonetid);
-       EGOTO1(mfail, code, "Failed to delete the cloned volume %u\n",
-              newVol);
-       VDONE;
-
-       VPRINT1("Ending transaction on cloned volume %u ...", newVol);
-       code = AFSVolEndTrans(fromconn, clonetid, &rcode);
-       if (!code)
-           code = rcode;
-       clonetid = 0;
-       EGOTO1(mfail, code,
-              "Failed to end the transaction on the cloned volume %u\n",
-              newVol);
-       VDONE;
+       code = DoVolDelete(fromconn, newVol, afrompart,
+                          "cloned", 0, NULL, NULL);
+       if (code) {
+           if (code == VNOVOL) {
+               EPRINT1(code, "Failed to start transaction on %u\n", newVol);
+           }
+           error = code;
+           goto mfail;
+       }
     }
 
     /* fall through */
@@ -2058,20 +2164,20 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
     }
 
     VPRINT("Recovery: Accessing VLDB.\n");
-    vcode = VLDB_GetEntryByIDU(afromvol, -1, &entry);
+    vcode = VLDB_GetEntryByID(afromvol, -1, &entry);
     if (vcode) {
        fprintf(STDOUT, "FATAL: VLDB access error: abort cleanup\n");
        fflush(STDOUT);
        goto done;
     }
-    MapHostToNetworkU(&entry);
+    MapHostToNetwork(&entry);
 
     /* Delete either the volume on the source location or the target location.
      * If the vldb entry still points to the source location, then we know the
      * 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_MatchU(afromserver, afrompart, &entry)) {   /* didn't move - delete target volume */
+    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");
@@ -2079,40 +2185,12 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
        }
 
        if (volid && toconn) {
-           VPRINT1
-               ("Recovery: Creating transaction for destination volume %u ...",
-                volid);
-           tmp = totid;
-           code =
-               AFSVolTransCreate_retry(toconn, volid, atopart, ITOffline, &tmp);
-           totid = tmp;
-
-           if (!code) {
-               VDONE;
-
-               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
-                   ("\nRecovery: Unable to start transaction on destination volume %u.\n",
-                    afromvol);
+           code = DoVolDelete(toconn, volid, atopart,
+                              "destination", 0, NULL, "Recovery:");
+           if (code == VNOVOL) {
+               EPRINT1(code, "Recovery: Failed to start transaction on %u\n", volid);
            }
-       }
+        }
 
        /* put source volume on-line */
        if (fromconn) {
@@ -2149,103 +2227,29 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
            fflush(STDOUT);
        }
 
-       /* delete backup volume */
-       if (fromconn) {
-           VPRINT1("Recovery: Creating transaction on backup volume %u ...",
-                   backupId);
-           tmp = fromtid;
-           code =
-               AFSVolTransCreate_retry(fromconn, backupId, afrompart, ITOffline,
-                                 &tmp);
-           fromtid = tmp;
-           if (!code) {
-               VDONE;
-
-               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
-                   ("\nRecovery: Unable to start transaction on backup volume %u.\n",
-                    backupId);
-           }
-
-           /* delete source volume */
-           VPRINT1("Recovery: Creating transaction on source volume %u ...",
-                   afromvol);
-           tmp = fromtid;
-           code =
-               AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITBusy,
-                                 &tmp);
-           fromtid = tmp;
-           if (!code) {
-               VDONE;
-
-               VPRINT1("Recovery: Setting flags on backup volume %u ...",
-                       afromvol);
-               AFSVolSetFlags(fromconn, fromtid,
-                              VTDeleteOnSalvage | VTOutOfService);
-               VDONE;
-
-               if (atoserver != afromserver) {
-                   VPRINT("Recovery: Setting volume forwarding pointer ...");
-                   AFSVolSetForwarding(fromconn, fromtid, atoserver);
-                   VDONE;
-               }
-
-               VPRINT1("Recovery: Deleting source volume %u ...", afromvol);
-               AFSVolDeleteVolume(fromconn, fromtid);
-               VDONE;
-
-               VPRINT1
-                   ("Recovery: Ending transaction on source volume %u ...",
-                    afromvol);
-               AFSVolEndTrans(fromconn, fromtid, &rcode);
-               VDONE;
-           } else {
-               VPRINT1
-                   ("\nRecovery: Unable to start transaction on source volume %u.\n",
-                    afromvol);
-           }
-       }
-    }
-
-    /* common cleanup - delete local clone */
-    if (newVol) {
-       VPRINT1("Recovery: Creating transaction on clone volume %u ...",
-               newVol);
-       tmp = clonetid;
-       code =
-           AFSVolTransCreate_retry(fromconn, newVol, afrompart, ITOffline,
-                             &tmp);
-       clonetid = tmp;
-       if (!code) {
-           VDONE;
+       /* delete backup volume */
+       if (fromconn) {
+           code = DoVolDelete(fromconn, backupId, afrompart,
+                              "backup", 0, NULL, "Recovery:");
+           if (code == VNOVOL) {
+               EPRINT1(code, "Recovery: Failed to start transaction on %u\n", backupId);
+           }
 
-           VPRINT1("Recovery: Deleting clone volume %u ...", newVol);
-           AFSVolDeleteVolume(fromconn, clonetid);
-           VDONE;
+           code = DoVolDelete(fromconn, afromvol, afrompart, "source",
+                              (atoserver != afromserver)?atoserver:0,
+                       NULL, NULL);
+           if (code == VNOVOL) {
+               EPRINT1(code, "Failed to start transaction on %u\n", afromvol);
+           }
+       }
+    }
 
-           VPRINT1("Recovery: Ending transaction on clone volume %u ...",
-                   newVol);
-           AFSVolEndTrans(fromconn, clonetid, &rcode);
-           VDONE;
-       } else {
-           VPRINT1
-               ("\nRecovery: Unable to start transaction on source volume %u.\n",
-                afromvol);
+    /* common cleanup - delete local clone */
+    if (newVol) {
+       code = DoVolDelete(fromconn, newVol, afrompart,
+                          "clone", 0, NULL, "Recovery:");
+       if (code == VNOVOL) {
+           EPRINT1(code, "Recovery: Failed to start transaction on %u\n", newVol);
        }
     }
 
@@ -2256,7 +2260,6 @@ UV_MoveVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
        ubik_VL_ReleaseLock(cstruct, 0, afromvol, -1,
                            (LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP));
        VDONE;
-       islocked = 0;
     }
   done:                        /* routine cleanup */
     if (volName)
@@ -2322,7 +2325,7 @@ UV_CopyVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
     afs_int32 volflag;
     struct volser_status tstatus;
     struct destServer destination;
-    struct uvldbentry entry, newentry, storeEntry;
+    struct nvldbentry entry, newentry, storeEntry;
     afs_int32 error;
     afs_int32 tmp;
     afs_uint32 tmpVol;
@@ -2341,11 +2344,11 @@ UV_CopyVolume2(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
        goto mfail;
     (void)signal(SIGINT, sigint_handler);
 
-    vcode = VLDB_GetEntryByIDU(afromvol, -1, &entry);
+    vcode = VLDB_GetEntryByID(afromvol, -1, &entry);
     EGOTO1(mfail, vcode,
           "Could not fetch the entry for the volume  %u from the VLDB \n",
           afromvol);
-    MapHostToNetworkU(&entry);
+    MapHostToNetwork(&entry);
 
     pntg = 1;
     toconn = UV_Bind(atoserver, AFSCONF_VOLUMEPORT);   /* get connections to the servers */
@@ -2622,40 +2625,22 @@ cpincr:
     fromtid = 0;
 
     if (!(flags & RV_NOCLONE)) {
-       VPRINT1("Starting transaction on the cloned volume %u ...", cloneVol);
-       tmp = clonetid;
-       code =
-           AFSVolTransCreate_retry(fromconn, cloneVol, afrompart, ITOffline,
-                             &tmp);
-       clonetid = tmp;
-       EGOTO1(mfail, code,
-              "Failed to start a transaction on the cloned volume%u\n",
-              cloneVol);
-       VDONE;
-
-       /* now delete the clone */
-       VPRINT1("Deleting the cloned volume %u ...", cloneVol);
-       code = AFSVolDeleteVolume(fromconn, clonetid);
-       EGOTO1(mfail, code, "Failed to delete the cloned volume %u\n",
-              cloneVol);
-       VDONE;
-
-       VPRINT1("Ending transaction on cloned volume %u ...", cloneVol);
-       code = AFSVolEndTrans(fromconn, clonetid, &rcode);
-       if (!code)
-           code = rcode;
-       clonetid = 0;
-       EGOTO1(mfail, code,
-              "Failed to end the transaction on the cloned volume %u\n",
-              cloneVol);
-       VDONE;
+       code = DoVolDelete(fromconn, cloneVol, afrompart,
+                          "cloned", 0, NULL, NULL);
+       if (code) {
+           if (code == VNOVOL) {
+               EPRINT1(code, "Failed to start transaction on %u\n", cloneVol);
+           }
+           error = code;
+           goto mfail;
+       }
     }
 
     if (!(flags & RV_NOVLDB)) {
        /* create the vldb entry for the copied volume */
        strncpy(newentry.name, atovolname, VOLSER_OLDMAXVOLNAME);
        newentry.nServers = 1;
-       newentry.serverUnique[0] = atoserver;
+       newentry.serverNumber[0] = atoserver;
        newentry.serverPartition[0] = atopart;
        newentry.flags = (flags & RV_RDONLY) ? RO_EXISTS : RW_EXISTS;
        newentry.serverFlags[0] = (flags & RV_RDONLY) ? ITSROVOL : ITSRWVOL;
@@ -2665,9 +2650,9 @@ cpincr:
        newentry.cloneId = 0;
        /*map into right byte order, before passing to xdr, the stuff has to be in host
         * byte order. Xdr converts it into network order */
-       MapNetworkToHostU(&newentry, &storeEntry);
+       MapNetworkToHost(&newentry, &storeEntry);
        /* create the vldb entry */
-       vcode = VLDB_CreateEntryU(&storeEntry);
+       vcode = VLDB_CreateEntry(&storeEntry);
        if (vcode) {
            fprintf(STDERR,
                    "Could not create a VLDB entry for the volume %s %lu\n",
@@ -2762,38 +2747,20 @@ cpincr:
     }
 
     VPRINT("Recovery: Accessing VLDB.\n");
-    vcode = VLDB_GetEntryByIDU(afromvol, -1, &entry);
+    vcode = VLDB_GetEntryByID(afromvol, -1, &entry);
     if (vcode) {
        fprintf(STDOUT, "FATAL: VLDB access error: abort cleanup\n");
        fflush(STDOUT);
        goto done;
     }
-    MapHostToNetworkU(&entry);
+    MapHostToNetwork(&entry);
 
     /* common cleanup - delete local clone */
     if (cloneVol) {
-       VPRINT1("Recovery: Creating transaction on clone volume %u ...",
-               cloneVol);
-       tmp = clonetid;
-       code =
-           AFSVolTransCreate_retry(fromconn, cloneVol, afrompart, ITOffline,
-                             &tmp);
-       clonetid = tmp;
-       if (!code) {
-           VDONE;
-
-           VPRINT1("Recovery: Deleting clone volume %u ...", cloneVol);
-           AFSVolDeleteVolume(fromconn, clonetid);
-           VDONE;
-
-           VPRINT1("Recovery: Ending transaction on clone volume %u ...",
-                   cloneVol);
-           AFSVolEndTrans(fromconn, clonetid, &rcode);
-           VDONE;
-       } else {
-           VPRINT1
-               ("\nRecovery: Unable to start transaction on clone volume %u.\n",
-                cloneVol);
+       code = DoVolDelete(fromconn, cloneVol, afrompart,
+                          "clone", 0, NULL, "Recovery:");
+       if (code == VNOVOL) {
+           EPRINT1(code, "Recovery: Failed to start transaction on %u\n", cloneVol);
        }
     }
 
@@ -2832,16 +2799,15 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
     afs_int32 ttid = 0, btid = 0;
     afs_uint32 backupID;
     afs_int32 code = 0, rcode = 0;
-    char vname[VOLSER_MAXVOLNAME + 1];
-    struct uvldbentry entry, storeEntry;
+    struct nvldbentry entry, storeEntry;
     afs_int32 error = 0;
-    int vldblocked = 0, vldbmod = 0, backexists = 1;
+    int vldblocked = 0, vldbmod = 0;
 
     aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
 
     /* the calls to VLDB will succeed only if avolid is a RW volume,
      * since we are following the RW hash chain for searching */
-    code = VLDB_GetEntryByIDU(avolid, RWVOL, &entry);
+    code = VLDB_GetEntryByID(avolid, RWVOL, &entry);
     if (code) {
        fprintf(STDERR,
                "Could not fetch the entry for the volume %lu from the VLDB \n",
@@ -2849,7 +2815,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
        error = code;
        goto bfail;
     }
-    MapHostToNetworkU(&entry);
+    MapHostToNetwork(&entry);
 
     /* These operations require the VLDB be locked since it means the VLDB
      * will change or the vldb is already locked.
@@ -2869,7 +2835,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
        vldblocked = 1;
 
        /* Reread the vldb entry */
-       code = VLDB_GetEntryByIDU(avolid, RWVOL, &entry);
+       code = VLDB_GetEntryByID(avolid, RWVOL, &entry);
        if (code) {
            fprintf(STDERR,
                    "Could not fetch the entry for the volume %lu from the VLDB \n",
@@ -2877,7 +2843,7 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
            error = code;
            goto bfail;
        }
-       MapHostToNetworkU(&entry);
+       MapHostToNetwork(&entry);
     }
 
     if (!ISNAMEVALID(entry.name)) {
@@ -2904,82 +2870,14 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
        vldbmod = 1;
     }
 
-    /* Test to see if the backup volume exists by trying to create
-     * a transaction on the backup volume. We've assumed the backup exists.
-     */
-    code = AFSVolTransCreate_retry(aconn, backupID, apart, ITOffline, &btid);
-    if (code) {
-       if (code != VNOVOL) {
-           fprintf(STDERR, "Could not reach the backup volume %lu\n",
-                   (unsigned long)backupID);
-           error = code;
-           goto bfail;
-       }
-       backexists = 0;         /* backup volume does not exist */
-    }
-    if (btid) {
-       code = AFSVolEndTrans(aconn, btid, &rcode);
-       btid = 0;
-       if (code || rcode) {
-           fprintf(STDERR,
-                   "Could not end transaction on the previous backup volume %lu\n",
-                   (unsigned long)backupID);
-           error = (code ? code : rcode);
-           goto bfail;
-       }
-    }
-
-    /* Now go ahead and try to clone the RW volume.
-     * First start a transaction on the RW volume
-     */
-    code = AFSVolTransCreate_retry(aconn, avolid, apart, ITBusy, &ttid);
+    code = DoVolClone(aconn, avolid, apart, backupVolume, backupID, "backup",
+                     entry.name, NULL, ".backup", NULL, NULL);
     if (code) {
-       fprintf(STDERR, "Could not start a transaction on the volume %lu\n",
-               (unsigned long)avolid);
        error = code;
        goto bfail;
     }
 
-    /* Clone or reclone the volume, depending on whether the backup
-     * volume exists or not
-     */
-    if (backexists) {
-       VPRINT1("Re-cloning backup volume %u ...", backupID);
-
-       code = AFSVolReClone(aconn, ttid, backupID);
-       if (code) {
-           fprintf(STDERR, "Could not re-clone backup volume %lu\n",
-                   (unsigned long)backupID);
-           error = code;
-           goto bfail;
-       }
-    } else {
-       VPRINT1("Creating a new backup clone %u ...", backupID);
-
-       strcpy(vname, entry.name);
-       strcat(vname, ".backup");
-
-       code = AFSVolClone(aconn, ttid, 0, backupVolume, vname, &backupID);
-       if (code) {
-           fprintf(STDERR, "Failed to clone the volume %lu\n",
-                   (unsigned long)avolid);
-           error = code;
-           goto bfail;
-       }
-    }
-
-    /* End the transaction on the RW volume */
-    code = AFSVolEndTrans(aconn, ttid, &rcode);
-    ttid = 0;
-    if (code || rcode) {
-       fprintf(STDERR,
-               "Failed to end the transaction on the rw volume %lu\n",
-               (unsigned long)avolid);
-       error = (code ? code : rcode);
-       goto bfail;
-    }
-
-    /* Mork vldb as backup exists */
+    /* Mark vldb as backup exists */
     if (!(entry.flags & BACK_EXISTS)) {
        entry.flags |= BACK_EXISTS;
        vldbmod = 1;
@@ -3042,9 +2940,9 @@ UV_BackupVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid)
     /* Now update the vldb - if modified */
     if (vldblocked) {
        if (vldbmod) {
-           MapNetworkToHostU(&entry, &storeEntry);
+           MapNetworkToHost(&entry, &storeEntry);
            code =
-               VLDB_ReplaceEntryU(avolid, RWVOL, &storeEntry,
+               VLDB_ReplaceEntry(avolid, RWVOL, &storeEntry,
                                  (LOCKREL_OPCODE | LOCKREL_AFSID |
                                   LOCKREL_TIMESTAMP));
            if (code) {
@@ -3095,8 +2993,8 @@ UV_CloneVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid,
     afs_int32 code = 0, rcode = 0;
     char vname[VOLSER_MAXVOLNAME + 1];
     afs_int32 error = 0;
-    int backexists = 1;
     volEntries volumeInfo;
+    int type = 0;
 
     aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
 
@@ -3130,81 +3028,20 @@ UV_CloneVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid,
        VDONE;
     }
 
-    /* Test to see if the clone volume exists by trying to create
-     * a transaction on the clone volume. We've assumed the clone exists.
-     */
-    /* XXX I wonder what happens if the clone has some other parent... */
-    code = AFSVolTransCreate_retry(aconn, acloneid, apart, ITOffline, &btid);
-    if (code) {
-       if (code != VNOVOL) {
-           fprintf(STDERR, "Could not reach the clone volume %lu\n",
-                   (unsigned long)acloneid);
-           error = code;
-           goto bfail;
-       }
-       backexists = 0;         /* backup volume does not exist */
-    }
-    if (btid) {
-       code = AFSVolEndTrans(aconn, btid, &rcode);
-       btid = 0;
-       if (code || rcode) {
-           fprintf(STDERR,
-                   "Could not end transaction on the previous clone volume %lu\n",
-                   (unsigned long)acloneid);
-           error = (code ? code : rcode);
-           goto bfail;
-       }
-    }
+    if (flags & RV_RWONLY)
+       type = readwriteVolume;
+    else if (flags & RV_RDONLY)
+       type = readonlyVolume;
+    else
+       type = backupVolume;
 
-    /* Now go ahead and try to clone the RW volume.
-     * First start a transaction on the RW volume
-     */
-    code = AFSVolTransCreate_retry(aconn, avolid, apart, ITBusy, &ttid);
+    code = DoVolClone(aconn, avolid, apart, type, acloneid, "clone",
+                     NULL, ".clone", NULL, NULL, NULL);
     if (code) {
-       fprintf(STDERR, "Could not start a transaction on the volume %lu\n",
-               (unsigned long)avolid);
        error = code;
        goto bfail;
     }
 
-    /* Clone or reclone the volume, depending on whether the backup
-     * volume exists or not
-     */
-    if (backexists) {
-       VPRINT1("Re-cloning clone volume %u ...", acloneid);
-
-       code = AFSVolReClone(aconn, ttid, acloneid);
-       if (code) {
-           fprintf(STDERR, "Could not re-clone backup volume %lu\n",
-                   (unsigned long)acloneid);
-           error = code;
-           goto bfail;
-       }
-    } else {
-       VPRINT1("Creating a new clone %u ...", acloneid);
-
-       code = AFSVolClone(aconn, ttid, 0,
-                          (flags & RV_RDONLY) ? readonlyVolume : backupVolume,
-                          aname, &acloneid);
-       if (code) {
-           fprintf(STDERR, "Failed to clone the volume %lu\n",
-                   (unsigned long)avolid);
-           error = code;
-           goto bfail;
-       }
-    }
-
-    /* End the transaction on the RW volume */
-    code = AFSVolEndTrans(aconn, ttid, &rcode);
-    ttid = 0;
-    if (code || rcode) {
-       fprintf(STDERR,
-               "Failed to end the transaction on the rw volume %lu\n",
-               (unsigned long)avolid);
-       error = (code ? code : rcode);
-       goto bfail;
-    }
-
     /* Now go back to the backup volume and bring it on line */
     if (!(flags & RV_OFFLINE)) {
        code = AFSVolTransCreate_retry(aconn, acloneid, apart, ITOffline, &btid);
@@ -3266,34 +3103,6 @@ UV_CloneVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 avolid,
     return error;
 }
 
-static int
-DelVol(struct rx_connection *conn, afs_uint32 vid, afs_int32 part,
-       afs_int32 flags)
-{
-    afs_int32 acode, ccode, rcode, tid;
-    ccode = rcode = tid = 0;
-
-    acode = AFSVolTransCreate_retry(conn, vid, part, flags, &tid);
-    if (!acode) {              /* It really was there */
-       acode = AFSVolDeleteVolume(conn, tid);
-       if (acode) {
-           fprintf(STDERR, "Failed to delete volume %lu.\n",
-                   (unsigned long)vid);
-           PrintError("", acode);
-       }
-       ccode = AFSVolEndTrans(conn, tid, &rcode);
-       if (!ccode)
-           ccode = rcode;
-       if (ccode) {
-           fprintf(STDERR, "Failed to end transaction on volume %lu.\n",
-                   (unsigned long)vid);
-           PrintError("", ccode);
-       }
-    }
-
-    return acode;
-}
-
 #define ONERROR(ec, ep, es) do { \
     if (ec) { \
         fprintf(STDERR, (es), (ep)); \
@@ -3318,10 +3127,10 @@ DelVol(struct rx_connection *conn, afs_uint32 vid, afs_int32 part,
  * be made (0 if it's a new volume)
  */
 static int
-GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index,
+GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
         struct rx_connection **connPtr, afs_int32 * transPtr,
         afs_uint32 * crtimePtr, afs_uint32 * uptimePtr,
-        afs_int32 *origflags)
+        afs_int32 *origflags, afs_uint32 tmpVolId)
 {
     afs_uint32 volid;
     struct volser_status tstatus;
@@ -3335,11 +3144,12 @@ GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index,
     *uptimePtr = 0;
 
     /* get connection to the replication site */
-    *connPtr = UV_Bind(vldbEntryPtr->serverUnique[index], AFSCONF_VOLUMEPORT);
+    *connPtr = UV_Bind(vldbEntryPtr->serverNumber[index], AFSCONF_VOLUMEPORT);
     if (!*connPtr)
        goto fail;              /* server is down */
 
     volid = vldbEntryPtr->volumeId[ROVOL];
+
     if (volid) {
        code =
            AFSVolTransCreate_retry(*connPtr, volid,
@@ -3356,9 +3166,9 @@ GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index,
 
            VPRINT1("Deleting extant RO_DONTUSE site on %s...",
                     noresolve ? afs_inet_ntoa_r(vldbEntryPtr->
-                                                serverUnique[index], hoststr) :
+                                                serverNumber[index], hoststr) :
                     hostutil_GetNameByINet(vldbEntryPtr->
-                                          serverUnique[index]));
+                                          serverNumber[index]));
 
            code = AFSVolDeleteVolume(*connPtr, *transPtr);
            if (code) {
@@ -3387,7 +3197,7 @@ GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index,
 
     /* If the volume does not exist, create it */
     if (!volid || code) {
-       char volname[64];
+       char volname[VL_MAXNAMELEN];
         char hoststr[16];
 
        if (volid && (code != VNOVOL)) {
@@ -3396,25 +3206,33 @@ GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index,
            goto fail;
        }
 
-       strcpy(volname, vldbEntryPtr->name);
-       strcat(volname, ".readonly");
+       strlcpy(volname, vldbEntryPtr->name, sizeof(volname));
+
+       if (strlcat(volname,
+                   tmpVolId?".roclone":".readonly",
+                   sizeof(volname)) >= sizeof(volname)) {
+           code = ENOMEM;
+           PrintError("Volume name is too long\n", code);
+           goto fail;
+       }
 
        if (verbose) {
            fprintf(STDOUT,
                    "Creating new volume %lu on replication site %s: ",
-                   (unsigned long)volid,
+                   tmpVolId?(unsigned long)tmpVolId:(unsigned long)volid,
                     noresolve ? afs_inet_ntoa_r(vldbEntryPtr->
-                                                serverUnique[index], hoststr) :
+                                                serverNumber[index], hoststr) :
                     hostutil_GetNameByINet(vldbEntryPtr->
-                                          serverUnique[index]));
+                                          serverNumber[index]));
            fflush(STDOUT);
        }
 
        code =
-           AFSVolCreateVolume(*connPtr, vldbEntryPtr->serverPartition[index],
-                              volname, volser_RO,
-                              vldbEntryPtr->volumeId[RWVOL], &volid,
-                              transPtr);
+         AFSVolCreateVolume(*connPtr, vldbEntryPtr->serverPartition[index],
+                            volname, volser_RO,
+                            vldbEntryPtr->volumeId[RWVOL],
+                            tmpVolId?&tmpVolId:&volid,
+                            transPtr);
        if (code) {
            PrintError("Failed to create the ro volume: ", code);
            goto fail;
@@ -3439,8 +3257,8 @@ GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index,
     else {
        VPRINT2("Updating existing ro volume %u on %s ...\n", volid,
                 noresolve ? afs_inet_ntoa_r(vldbEntryPtr->
-                                            serverUnique[index], hoststr) :
-                hostutil_GetNameByINet(vldbEntryPtr->serverUnique[index]));
+                                            serverNumber[index], hoststr) :
+                hostutil_GetNameByINet(vldbEntryPtr->serverNumber[index]));
 
        code = AFSVolGetStatus(*connPtr, *transPtr, &tstatus);
        if (code) {
@@ -3448,6 +3266,20 @@ GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index,
                       code);
            goto fail;
        }
+       if (tmpVolId) {
+           code = AFSVolEndTrans(*connPtr, *transPtr, &rcode);
+           *transPtr = 0;
+           if (!code)
+               code = rcode;
+           if (!code)
+               code = DoVolClone(*connPtr, volid,
+                                 vldbEntryPtr->serverPartition[index],
+                                 readonlyVolume, tmpVolId, "temporary",
+                                 vldbEntryPtr->name, NULL, ".roclone", NULL,
+                                 transPtr);
+           if (code)
+               goto fail;
+       }
        *crtimePtr = CLOCKADJ(tstatus.creationDate);
        *uptimePtr = CLOCKADJ(tstatus.updateDate);
     }
@@ -3460,7 +3292,7 @@ GetTrans(struct uvldbentry *vldbEntryPtr, afs_int32 index,
        *transPtr = 0;
        if (!tcode)
            tcode = rcode;
-       if (tcode)
+       if (tcode && tcode != ENOENT)
            PrintError("Could not end transaction on a ro volume: ", tcode);
     }
 
@@ -3549,32 +3381,107 @@ CheckTrans(struct rx_connection *aconn, afs_int32 *atid, afs_int32 apart,
     return 0;
 }
 
+static void
+PutTrans(afs_int32 *vldbindex, struct replica *replicas,
+        struct rx_connection **toconns, struct release *times,
+        afs_int32 volcount)
+{
+    afs_int32 s, code = 0, rcode = 0;
+    /* End the transactions and destroy the connections */
+    for (s = 0; s < volcount; s++) {
+       if (replicas[s].trans) {
+           code = AFSVolEndTrans(toconns[s], replicas[s].trans, &rcode);
+
+           replicas[s].trans = 0;
+           if (!code)
+               code = rcode;
+           if (code) {
+               if ((s == 0) || (code != ENOENT)) {
+                   PrintError("Could not end transaction on a ro volume: ",
+                              code);
+               } else {
+                   PrintError
+                       ("Transaction timed out on a ro volume. Will retry.\n",
+                        0);
+                   if (times[s].vldbEntryIndex < *vldbindex)
+                       *vldbindex = times[s].vldbEntryIndex;
+               }
+           }
+       }
+       if (toconns[s])
+           rx_DestroyConnection(toconns[s]);
+       toconns[s] = 0;
+    }
+}
+
+static int
+DoVolOnline(struct nvldbentry *vldbEntryPtr, afs_uint32 avolid, int index,
+           char *vname, struct rx_connection *connPtr)
+{
+    afs_int32 code = 0, rcode = 0, onlinetid = 0;
+
+    code =
+       AFSVolTransCreate_retry(connPtr, avolid,
+                               vldbEntryPtr->serverPartition[index],
+                               ITOffline,
+                               &onlinetid);
+    if (code)
+      EPRINT(code, "Could not create transaction on readonly...\n");
+
+    else {
+       code = AFSVolSetFlags(connPtr, onlinetid, 0);
+       if (code)
+           EPRINT(code, "Could not set flags on readonly...\n");
+    }
+
+    if (!code) {
+       code =
+           AFSVolSetIdsTypes(connPtr, onlinetid, vname,
+                             ROVOL, vldbEntryPtr->volumeId[RWVOL],
+                             0, 0);
+       if (code)
+           EPRINT(code, "Could not set ids on readonly...\n");
+    }
+    if (!code)
+       code = AFSVolEndTrans(connPtr, onlinetid, &rcode);
+    if (!code)
+       code = rcode;
+    return code;
+}
 
-/* UV_ReleaseVolume()
- *    Release volume <afromvol> on <afromserver> <afrompart> to all
- *    its RO sites (full release). Unless the previous release was
- *    incomplete: in which case we bring the remaining incomplete
- *    volumes up to date with the volumes that were released
- *    successfully.
- *    forceflag: Performs a full release.
+/**
+ * Release a volume to read-only sites
+ *
+ * Release volume <afromvol> on <afromserver> <afrompart> to all
+ * its RO sites (full release). Unless the previous release was
+ * incomplete: in which case we bring the remaining incomplete
+ * volumes up to date with the volumes that were released
+ * successfully.
  *
- *    Will create a clone from the RW, then dump the clone out to
- *    the remaining replicas. If there is more than 1 RO sites,
- *    ensure that the VLDB says at least one RO is available all
- *    the time: Influences when we write back the VLDB entry.
+ * Will create a clone from the RW, then dump the clone out to
+ * the remaining replicas. If there is more than 1 RO sites,
+ * ensure that the VLDB says at least one RO is available all
+ * the time: Influences when we write back the VLDB entry.
+ *
+ * @param[in] afromvol      volume to be released
+ * @param[in] afromserver   server containing afromvol
+ * @param[in] afrompart     partition containing afromvol
+ * @param[in] flags         bitmap of options
+ *                            REL_COMPLETE  - force a complete release
+ *                            REL_FULLDUMPS - force full dumps
+ *                            REL_STAYUP    - dump to clones to avoid offline time
  */
-
 int
 UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
-                afs_int32 afrompart, int forceflag)
+                afs_int32 afrompart, int flags)
 {
     char vname[64];
     afs_int32 code = 0;
     afs_int32 vcode, rcode, tcode;
-    afs_uint32 cloneVolId, roVolId;
+    afs_uint32 cloneVolId = 0, roVolId;
     struct replica *replicas = 0;
-    struct uvldbentry entry, storeEntry;
-    int i, volcount, m, fullrelease, vldbindex;
+    struct nvldbentry entry, storeEntry;
+    int i, volcount = 0, m, vldbindex;
     int failure;
     struct restoreCookie cookie;
     struct rx_connection **toconns = 0;
@@ -3592,7 +3499,7 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
     manyDests tr;
     manyResults results;
     int rwindex, roindex, roclone, roexists;
-    afs_uint32 rwcrdate = 0;
+    afs_uint32 rwcrdate = 0, rwupdate = 0;
     afs_uint32 clcrdate;
     struct rtime {
        int validtime;
@@ -3603,6 +3510,23 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
     char hoststr[16];
     afs_int32 origflags[NMAXNSERVERS];
     struct volser_status orig_status;
+    int notreleased = 0;
+    int tried_justnewsites = 0;
+    int justnewsites = 0; /* are we just trying to release to new RO sites? */
+    int sites = 0; /* number of ro sites */
+    int new_sites = 0; /* number of ro sites markes as new */
+    int stayUp = (flags & REL_STAYUP);
+
+    typedef enum {
+        CR_RECOVER    = 0x0000, /**< not complete: a recovery from a previous failed release */
+        CR_FORCED     = 0x0001, /**< complete: forced by caller */
+        CR_LAST_OK    = 0x0002, /**< complete: no sites have been marked as new release */
+        CR_ALL_NEW    = 0x0004, /**< complete: all sites have been marked as new release */
+        CR_NEW_RW     = 0x0008, /**< complete: read-write has changed */
+        CR_RO_MISSING = 0x0010, /**< complete: ro clone is missing */
+    } complete_release_t;
+
+    complete_release_t complete_release = CR_RECOVER;
 
     memset(remembertime, 0, sizeof(remembertime));
     memset(&results, 0, sizeof(results));
@@ -3615,13 +3539,13 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
     islocked = 1;
 
     /* Get the vldb entry in readable format */
-    vcode = VLDB_GetEntryByIDU(afromvol, RWVOL, &entry);
+    vcode = VLDB_GetEntryByID(afromvol, RWVOL, &entry);
     ONERROR(vcode, afromvol,
            "Could not fetch the entry for the volume %u from the VLDB.\n");
-    MapHostToNetworkU(&entry);
+    MapHostToNetwork(&entry);
 
     if (verbose)
-       EnumerateEntryU(&entry);
+       EnumerateEntry(&entry);
 
     if (!ISNAMEVALID(entry.name))
        ONERROR(VOLSERBADOP, entry.name,
@@ -3641,9 +3565,9 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
      * on the same partition a clone instead of a complete copy.
      */
 
-    roindex = Lp_ROMatchU(afromserver, afrompart, &entry) - 1;
+    roindex = Lp_ROMatch(afromserver, afrompart, &entry) - 1;
     roclone = ((roindex == -1) ? 0 : 1);
-    rwindex = Lp_GetRwIndexU(&entry);
+    rwindex = Lp_GetRwIndex(&entry);
     if (rwindex < 0)
        ONERROR0(VOLSERNOVOL, "There is no RW volume \n");
 
@@ -3654,38 +3578,91 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
        ONERROR(vcode, entry.name, "Cant allocate ID for RO volume of %s\n");
 
        entry.volumeId[ROVOL] = roVolId;
-       MapNetworkToHostU(&entry, &storeEntry);
-       vcode = VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry, 0);
+       MapNetworkToHost(&entry, &storeEntry);
+       vcode = VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry, 0);
        ONERROR(vcode, entry.name, "Could not update vldb entry for %s.\n");
     }
 
-    /* Will we be completing a previously unfinished release. -force overrides */
-    for (s = 0, m = 0, fullrelease=0, i=0; (i<entry.nServers); i++) {
+    /*
+     * Determine if this is to be a complete release or a recovery of a
+     * previous unfinished release. The previous release is considered to be
+     * unfinished when the clone was successfully distributed to at least one
+     * (but not all) of the read-only sites, as indicated by the NEW_REPSITE
+     * vldb flags.
+     *
+     * The caller can override the vldb flags check using the -force
+     * or -force-reclone flag, to force this to be a complete release.
+     */
+    for (i = 0; i < entry.nServers; i++) {
        if (entry.serverFlags[i] & ITSROVOL) {
-           m++;
-           if (entry.serverFlags[i] & NEW_REPSITE) s++;
+           sites++;
+           if (entry.serverFlags[i] & NEW_REPSITE)
+               new_sites++;
+           if (entry.serverFlags[i] & RO_DONTUSE)
+               notreleased++;
        }
        origflags[i] = entry.serverFlags[i];
     }
-    if ((forceflag && !fullrelease) || (s == m) || (s == 0))
-       fullrelease = 1;
+
+    if (flags & REL_COMPLETE) {
+       complete_release |= CR_FORCED;
+    }
+
+    if (new_sites == 0) {
+       complete_release |= CR_LAST_OK;
+    } else if (new_sites == sites) {
+       complete_release |= CR_ALL_NEW;
+    }
+
+    if ((complete_release & (CR_LAST_OK | CR_ALL_NEW))
+       && !(complete_release & CR_FORCED)) {
+       if (notreleased && notreleased != sites) {
+           /* we have some new unreleased sites. try to just release to those,
+            * if the RW has not changed. The caller can override with -force
+            * or with -force-reclone. */
+           justnewsites = 1;
+       }
+    }
 
     /* Determine which volume id to use and see if it exists */
-    cloneVolId =
-       ((fullrelease
-         || (entry.cloneId == 0)) ? entry.volumeId[ROVOL] : entry.cloneId);
+    cloneVolId = (complete_release || entry.cloneId == 0)
+                 ? entry.volumeId[ROVOL] : entry.cloneId;
+
     code = VolumeExists(afromserver, afrompart, cloneVolId);
     roexists = ((code == ENODEV) ? 0 : 1);
 
+    /* For stayUp case, if roclone is the only site, bypass special handling */
+    if (stayUp && roclone) {
+       int e;
+       error = 0;
+
+       for (e = 0; (e < entry.nServers) && !error; e++) {
+           if ((entry.serverFlags[e] & ITSROVOL)) {
+               if (!(VLDB_IsSameAddrs(entry.serverNumber[e], afromserver,
+                                      &error)))
+                   break;
+           }
+       }
+       if (e >= entry.nServers)
+           stayUp = 0;
+    }
+
+    /* If we had a previous release to complete, do so, else: */
+    if (stayUp && (cloneVolId == entry.volumeId[ROVOL])) {
+       code = ubik_VL_GetNewVolumeId(cstruct, 0, 1, &cloneVolId);
+       ONERROR(code, afromvol,
+               "Cannot get temporary clone id for volume %u\n");
+    }
+
     fromconn = UV_Bind(afromserver, AFSCONF_VOLUMEPORT);
     if (!fromconn)
        ONERROR(-1, afromserver,
                "Cannot establish connection with server 0x%x\n");
 
-    if (!fullrelease) {
-       if (!roexists)
-           fullrelease = 1;    /* Do a full release if RO clone does not exist */
-       else {
+    if (!complete_release) {
+       if (!roexists) {
+           complete_release |= CR_RO_MISSING;  /* Do a complete release if RO clone does not exist */
+       } else {
            /* Begin transaction on RW and mark it busy while we query it */
            code = AFSVolTransCreate_retry(
                        fromconn, afromvol, afrompart, ITBusy, &fromtid
@@ -3725,99 +3702,220 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
                    "Failed to end transaction on RW clone %u\n");
 
            if (rwcrdate > clcrdate)
-               fullrelease = 2;/* Do a full release if RO clone older than RW */
+               complete_release |= CR_NEW_RW; /* Do a complete release if RO clone older than RW */
        }
     }
 
+    if (!complete_release || (complete_release & CR_NEW_RW)) {
+       /* in case the RW has changed, and just to be safe */
+       justnewsites = 0;
+    }
+
     if (verbose) {
-       switch (fullrelease) {
-           case 2:
-               fprintf(STDOUT, "RW %lu changed, doing a complete release\n",
-                       (unsigned long)afromvol);
-               break;
-           case 1:
-               fprintf(STDOUT, "This is a complete release of volume %lu\n",
-                       (unsigned long)afromvol);
-               break;
-           case 0:
-               fprintf(STDOUT, "This is a completion of a previous release\n");
-               break;
+       if (!complete_release) {
+           fprintf(STDOUT,
+                   "This is a recovery of previously failed release\n");
+       } else {
+           fprintf(STDOUT, "This is a complete release of volume %u", afromvol);
+           /* Give the reasons for a complete release, except if only CR_LAST_OK. */
+           if (complete_release != CR_LAST_OK) {
+               char *sep = " (";
+               if (complete_release & CR_FORCED) {
+                   fprintf(STDOUT, "%sforced", sep);
+                   sep = ", ";
+               }
+               if (complete_release & CR_LAST_OK) {
+                   fprintf(STDOUT, "%slast ok", sep);
+                   sep = ", ";
+               }
+               if (complete_release & CR_ALL_NEW) {
+                   fprintf(STDOUT, "%sall sites are new", sep);
+                   sep = ", ";
+               }
+               if (complete_release & CR_NEW_RW) {
+                   fprintf(STDOUT, "%srw %u changed", sep, afromvol);
+                   sep = ", ";
+               }
+               if (complete_release & CR_RO_MISSING) {
+                   fprintf(STDOUT, "%sro clone missing", sep);
+               }
+               fprintf(STDOUT, ")");
+           }
+           fprintf(STDOUT, "\n");
+           if (justnewsites) {
+               tried_justnewsites = 1;
+               fprintf(STDOUT, "There are new RO sites; we will try to "
+                       "only release to new sites\n");
+           }
        }
     }
 
-    if (fullrelease) {
+    if (complete_release) {
+       afs_int32 oldest = 0;
        /* If the RO clone exists, then if the clone is a temporary
         * clone, delete it. Or if the RO clone is marked RO_DONTUSE
         * (it was recently added), then also delete it. We do not
         * want to "reclone" a temporary RO clone.
         */
+       if (stayUp) {
+           code = VolumeExists(afromserver, afrompart, cloneVolId);
+           if (!code) {
+               code = DoVolDelete(fromconn, cloneVolId, afrompart, "previous clone", 0,
+                                  NULL, NULL);
+               if (code && (code != VNOVOL))
+                   ERROREXIT(code);
+               VDONE;
+           }
+       }
+       /* clean up any previous tmp clone before starting if staying up */
        if (roexists
            && (!roclone || (entry.serverFlags[roindex] & RO_DONTUSE))) {
-           code = DelVol(fromconn, cloneVolId, afrompart, ITOffline);
+           code = DoVolDelete(fromconn,
+                              stayUp ? entry.volumeId[ROVOL] : cloneVolId,
+                              afrompart, "the", 0, NULL, NULL);
            if (code && (code != VNOVOL))
                ERROREXIT(code);
            roexists = 0;
        }
 
+       if (justnewsites) {
+           VPRINT("Querying old RO sites for update times...");
+           for (vldbindex = 0; vldbindex < entry.nServers; vldbindex++) {
+               volEntries volumeInfo;
+               struct rx_connection *conn;
+               afs_int32 crdate;
+
+               if (!(entry.serverFlags[vldbindex] & ITSROVOL)) {
+                   continue;
+               }
+               if ((entry.serverFlags[vldbindex] & RO_DONTUSE)) {
+                   continue;
+               }
+               conn = UV_Bind(entry.serverNumber[vldbindex], AFSCONF_VOLUMEPORT);
+               if (!conn) {
+                   fprintf(STDERR, "Cannot establish connection to server %s\n",
+                                   hostutil_GetNameByINet(entry.serverNumber[vldbindex]));
+                   justnewsites = 0;
+                   break;
+               }
+               volumeInfo.volEntries_val = NULL;
+               volumeInfo.volEntries_len = 0;
+               code = AFSVolListOneVolume(conn, entry.serverPartition[vldbindex],
+                                          entry.volumeId[ROVOL],
+                                          &volumeInfo);
+               if (code) {
+                   fprintf(STDERR, "Could not fetch information about RO vol %lu from server %s\n",
+                                   (unsigned long)entry.volumeId[ROVOL],
+                                   hostutil_GetNameByINet(entry.serverNumber[vldbindex]));
+                   PrintError("", code);
+                   justnewsites = 0;
+                   rx_DestroyConnection(conn);
+                   break;
+               }
+
+               crdate = CLOCKADJ(volumeInfo.volEntries_val[0].creationDate);
+
+               if (oldest == 0 || crdate < oldest) {
+                   oldest = crdate;
+               }
+
+               rx_DestroyConnection(conn);
+               free(volumeInfo.volEntries_val);
+               volumeInfo.volEntries_val = NULL;
+               volumeInfo.volEntries_len = 0;
+           }
+           VDONE;
+       }
+       if (justnewsites) {
+           volEntries volumeInfo;
+           volumeInfo.volEntries_val = NULL;
+           volumeInfo.volEntries_len = 0;
+           code = AFSVolListOneVolume(fromconn, afrompart, afromvol,
+                                      &volumeInfo);
+           if (code) {
+               fprintf(STDERR, "Could not fetch information about RW vol %lu from server %s\n",
+                               (unsigned long)afromvol,
+                               hostutil_GetNameByINet(afromserver));
+               PrintError("", code);
+               justnewsites = 0;
+           } else {
+               rwupdate = volumeInfo.volEntries_val[0].updateDate;
+
+               free(volumeInfo.volEntries_val);
+               volumeInfo.volEntries_val = NULL;
+               volumeInfo.volEntries_len = 0;
+           }
+       }
+       if (justnewsites && oldest <= rwupdate) {
+           /* RW has changed */
+           justnewsites = 0;
+       }
+
        /* Mark all the ROs in the VLDB entry as RO_DONTUSE. We don't
         * write this entry out to the vlserver until after the first
         * RO volume is released (temp RO clones don't count).
+        *
+        * If 'justnewsites' is set, we're only updating sites that have
+        * RO_DONTUSE set, so set NEW_REPSITE for all of the others.
         */
        for (i = 0; i < entry.nServers; i++) {
-           entry.serverFlags[i] &= ~NEW_REPSITE;
-           entry.serverFlags[i] |= RO_DONTUSE;
+           if (justnewsites) {
+               if ((entry.serverFlags[i] & RO_DONTUSE)) {
+                   entry.serverFlags[i] &= ~NEW_REPSITE;
+               } else {
+                   entry.serverFlags[i] |= NEW_REPSITE;
+               }
+           } else {
+               entry.serverFlags[i] &= ~NEW_REPSITE;
+               entry.serverFlags[i] |= RO_DONTUSE;
+           }
        }
        entry.serverFlags[rwindex] |= NEW_REPSITE;
        entry.serverFlags[rwindex] &= ~RO_DONTUSE;
+    }
 
-       /* Begin transaction on RW and mark it busy while we clone it */
-       code =
-           AFSVolTransCreate_retry(fromconn, afromvol, afrompart, ITBusy,
-                             &clonetid);
-       ONERROR(code, afromvol, "Failed to start transaction on volume %u\n");
-
-       /* Clone or reclone the volume */
-       if (roexists) {
-           VPRINT1("Recloning RW volume %u...", cloneVolId);
-           code = AFSVolReClone(fromconn, clonetid, cloneVolId);
-           ONERROR(code, afromvol, "Failed to reclone the RW volume %u\n");
-           VDONE;
-       } else {
-           if (roclone) {
-               strcpy(vname, entry.name);
+    if (justnewsites && roexists) {
+       /* if 'justnewsites' and 'roexists' are set, we don't need to do
+        * anything with the RO clone, so skip the reclone */
+       /* noop */
+
+    } else if (complete_release) {
+
+       if (roclone) {
+           strcpy(vname, entry.name);
+           if (stayUp)
+               strcat(vname, ".roclone");
+           else
                strcat(vname, ".readonly");
-               VPRINT1("Cloning RW volume %u to permanent RO...", afromvol);
-           } else {
-               strcpy(vname, "readonly-clone-temp");
-               VPRINT1("Cloning RW volume %u to temporary RO...", afromvol);
+       } else {
+           strcpy(vname, "readonly-clone-temp");
+       }
+
+       code = DoVolClone(fromconn, afromvol, afrompart, readonlyVolume,
+                         cloneVolId, (roclone && !stayUp)?"permanent RO":
+                         "temporary RO", NULL, vname, NULL, &volstatus, NULL);
+       if (code) {
+           error = code;
+           goto rfail;
+       }
+
+       if (justnewsites && rwupdate != volstatus.updateDate) {
+           justnewsites = 0;
+           /* reset the serverFlags as if 'justnewsites' had never been set */
+           for (i = 0; i < entry.nServers; i++) {
+               entry.serverFlags[i] &= ~NEW_REPSITE;
+               entry.serverFlags[i] |= RO_DONTUSE;
            }
-           code =
-               AFSVolClone(fromconn, clonetid, 0, readonlyVolume, vname,
-                           &cloneVolId);
-           ONERROR(code, afromvol, "Failed to clone the RW volume %u\n");
-           VDONE;
+           entry.serverFlags[rwindex] |= NEW_REPSITE;
+           entry.serverFlags[rwindex] &= ~RO_DONTUSE;
        }
 
-       /* Get the time the RW was created for future information */
-       VPRINT1("Getting status of RW volume %u...", afromvol);
-       code = AFSVolGetStatus(fromconn, clonetid, &volstatus);
-       ONERROR(code, afromvol,
-               "Failed to get the status of the RW volume %u\n");
-       VDONE;
        rwcrdate = volstatus.creationDate;
 
-       /* End the transaction on the RW volume */
-       VPRINT1("Ending cloning transaction on RW volume %u...", afromvol);
-       code = AFSVolEndTrans(fromconn, clonetid, &rcode);
-       clonetid = 0;
-       ONERROR((code ? code : rcode), afromvol,
-               "Failed to end cloning transaction on RW %u\n");
-       VDONE;
-
        /* Remember clone volume ID in case we fail or are interrupted */
        entry.cloneId = cloneVolId;
 
-       if (roclone) {
+       if (roclone && !stayUp) {
            /* Bring the RO clone online - though not if it's a temporary clone */
            VPRINT1("Starting transaction on RO clone volume %u...",
                    cloneVolId);
@@ -3846,7 +3944,7 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
             * There is a fix in the 3.4 client that does not need this sleep
             * anymore, but we don't know what clients we have.
             */
-           if (entry.nServers > 2)
+           if (entry.nServers > 2 && !justnewsites)
                sleep(5);
 
            /* Mark the RO clone in the VLDB as a good site (already released) */
@@ -3861,15 +3959,23 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
             * up marking all the ROs as "old release" making the ROs
             * temporarily unavailable.
             */
-           MapNetworkToHostU(&entry, &storeEntry);
+           MapNetworkToHost(&entry, &storeEntry);
            VPRINT1("Replacing VLDB entry for %s...", entry.name);
-           vcode = VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry, 0);
+           vcode = VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry, 0);
            ONERROR(vcode, entry.name,
                    "Could not update vldb entry for %s.\n");
            VDONE;
        }
     }
 
+    if (justnewsites) {
+       VPRINT("RW vol has not changed; only releasing to new RO sites\n");
+       /* act like this is a completion of a previous release */
+       complete_release = CR_RECOVER;
+    } else if (tried_justnewsites) {
+       VPRINT("RW vol has changed; releasing to all sites\n");
+    }
+
     /* Now we will release from the clone to the remaining RO replicas.
      * The first 2 ROs (counting the non-temporary RO clone) are released
      * individually: releasecount. This is to reduce the race condition
@@ -3879,31 +3985,29 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
      */
 
     strcpy(vname, entry.name);
-    strcat(vname, ".readonly");
+    if (stayUp)
+       strcat(vname, ".roclone");
+    else
+       strcat(vname, ".readonly");
     memset(&cookie, 0, sizeof(cookie));
     strncpy(cookie.name, vname, VOLSER_OLDMAXVOLNAME);
     cookie.type = ROVOL;
     cookie.parent = entry.volumeId[RWVOL];
     cookie.clone = 0;
 
-    nservers = entry.nServers / 2;     /* how many to do at once, excluding clone */
-    replicas =
-       (struct replica *)malloc(sizeof(struct replica) * nservers + 1);
-    times = (struct release *)malloc(sizeof(struct release) * nservers + 1);
-    toconns =
-       (struct rx_connection **)malloc(sizeof(struct rx_connection *) *
-                                       nservers + 1);
-    results.manyResults_val =
-       (afs_int32 *) malloc(sizeof(afs_int32) * nservers + 1);
-    if (!replicas || !times || !!!results.manyResults_val || !toconns)
+    /* how many to do at once, excluding clone */
+    if (stayUp || justnewsites)
+       nservers = entry.nServers; /* can do all, none offline */
+    else
+       nservers = entry.nServers / 2;
+    replicas = calloc(nservers + 1, sizeof(struct replica));
+    times = calloc(nservers + 1, sizeof(struct release));
+    toconns = calloc(nservers + 1, sizeof(struct rx_connection *));
+    results.manyResults_val = calloc(nservers + 1, sizeof(afs_int32));
+    if (!replicas || !times || !results.manyResults_val || !toconns)
        ONERROR0(ENOMEM,
                "Failed to create transaction on the release clone\n");
 
-    memset(replicas, 0, (sizeof(struct replica) * nservers + 1));
-    memset(times, 0, (sizeof(struct release) * nservers + 1));
-    memset(toconns, 0, (sizeof(struct rx_connection *) * nservers + 1));
-    memset(results.manyResults_val, 0, (sizeof(afs_int32) * nservers + 1));
-
     /* Create a transaction on the cloned volume */
     VPRINT1("Starting transaction on cloned volume %u...", cloneVolId);
     code =
@@ -3912,26 +4016,36 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
        memset(&orig_status, 0, sizeof(orig_status));
        code = AFSVolGetStatus(fromconn, fromtid, &orig_status);
     }
-    if (!fullrelease && code)
+    if (!complete_release && code)
        ONERROR(VOLSERNOVOL, afromvol,
                "Old clone is inaccessible. Try vos release -f %u.\n");
     ONERROR0(code, "Failed to create transaction on the release clone\n");
     VDONE;
 
+    /* if we have a clone, treat this as done, for now */
+    if (stayUp && !complete_release) {
+       entry.serverFlags[roindex] |= NEW_REPSITE;
+       entry.serverFlags[roindex] &= ~RO_DONTUSE;
+       entry.flags |= RO_EXISTS;
+
+       releasecount++;
+    }
+
     /* For each index in the VLDB */
     for (vldbindex = 0; vldbindex < entry.nServers;) {
-
-       /* Get a transaction on the replicas. Pick replacas which have an old release. */
+       /* Get a transaction on the replicas. Pick replicas which have an old release. */
        for (volcount = 0;
             ((volcount < nservers) && (vldbindex < entry.nServers));
             vldbindex++) {
-           /* The first two RO volumes will be released individually.
-            * The rest are then released in parallel. This is a hack
-            * for clients not recognizing right away when a RO volume
-            * comes back on-line.
-            */
-           if ((volcount == 1) && (releasecount < 2))
-               break;
+           if (!stayUp && !justnewsites) {
+               /* The first two RO volumes will be released individually.
+                * The rest are then released in parallel. This is a hack
+                * for clients not recognizing right away when a RO volume
+                * comes back on-line.
+                */
+               if ((volcount == 1) && (releasecount < 2))
+                   break;
+           }
 
            if (vldbindex == roindex)
                continue;       /* the clone    */
@@ -3948,7 +4062,7 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
             * volume).  Each volume might have a different time.
             */
            replicas[volcount].server.destHost =
-               ntohl(entry.serverUnique[vldbindex]);
+               ntohl(entry.serverNumber[vldbindex]);
            replicas[volcount].server.destPort = AFSCONF_VOLUMEPORT;
            replicas[volcount].server.destSSID = 1;
            times[volcount].vldbEntryIndex = vldbindex;
@@ -3958,20 +4072,33 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
                         &(replicas[volcount].trans),
                         &(times[volcount].crtime),
                         &(times[volcount].uptime),
-                        origflags);
+                        origflags, stayUp?cloneVolId:0);
            if (code)
                continue;
 
            /* Thisdate is the date from which we want to pick up all changes */
-           if (forceflag || !fullrelease
-               || (rwcrdate > times[volcount].crtime)) {
-               /* If the forceflag is set, then we want to do a full dump.
-                * If it's not a full release, we can't be sure that the creation
-                *  date is good (so we also do a full dump).
-                * If the RW volume was replaced (its creation date is newer than
-                *  the last release), then we can't be sure what has changed (so
-                *  we do a full dump).
+           if (flags & REL_FULLDUMPS) {
+               /* Do a full dump when forced by the caller. */
+               VPRINT("This will be a full dump: forced\n");
+               thisdate = 0;
+           } else if (!complete_release) {
+               /* If this release is a recovery of a failed release, we can't be
+                * sure the creation date is good, so do a full dump.
                 */
+               VPRINT("This will be a full dump: previous release failed\n");
+               thisdate = 0;
+           } else if (times[volcount].crtime == 0) {
+               /* A full dump is needed for a new read-only volume. */
+               VPRINT
+                   ("This will be a full dump: read-only volume needs to be created\n");
+               thisdate = 0;
+           } else if ((rwcrdate > times[volcount].crtime)) {
+               /* If the RW volume was replaced (its creation date is newer than
+                * the last release), then we can't be sure what has changed (so
+                * we do a full dump).
+                */
+               VPRINT
+                   ("This will be a full dump: read-write volume was replaced\n");
                thisdate = 0;
            } else if (remembertime[vldbindex].validtime) {
                /* Trans was prev ended. Use the time from the prev trans
@@ -4016,24 +4143,25 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
 
        if (verbose) {
            fprintf(STDOUT, "Starting ForwardMulti from %lu to %u on %s",
-                   (unsigned long)cloneVolId, entry.volumeId[ROVOL],
-                    noresolve ? afs_inet_ntoa_r(entry.serverUnique[times[0].
+                   (unsigned long)cloneVolId, stayUp?
+                   cloneVolId:entry.volumeId[ROVOL],
+                    noresolve ? afs_inet_ntoa_r(entry.serverNumber[times[0].
                                                 vldbEntryIndex], hoststr) :
                     hostutil_GetNameByINet(entry.
-                                          serverUnique[times[0].
+                                          serverNumber[times[0].
                                                        vldbEntryIndex]));
 
            for (s = 1; s < volcount; s++) {
                fprintf(STDOUT, " and %s",
-                        noresolve ? afs_inet_ntoa_r(entry.serverUnique[times[s].
+                        noresolve ? afs_inet_ntoa_r(entry.serverNumber[times[s].
                                                     vldbEntryIndex], hoststr) :
                         hostutil_GetNameByINet(entry.
-                                              serverUnique[times[s].
+                                              serverNumber[times[s].
                                                            vldbEntryIndex]));
            }
 
            if (fromdate == 0)
-               fprintf(STDOUT, " (full release)");
+               fprintf(STDOUT, " (entire volume)");
            else {
                tmv = fromdate;
                fprintf(STDOUT, " (as of %.24s)", ctime(&tmv));
@@ -4103,36 +4231,166 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
            }
        }
 
-       /* End the transactions and destroy the connections */
+       if (!stayUp) {
+           PutTrans(&vldbindex, replicas, toconns, times, volcount);
+           MapNetworkToHost(&entry, &storeEntry);
+           vcode = VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry, 0);
+           ONERROR(vcode, afromvol,
+                   " Could not update VLDB entry for volume %u\n");
+       }
+    }                          /* for each index in the vldb */
+
+    /* for the stayup case, put back at the end */
+    if (stayUp) {
+       afs_uint32 tmpVol = entry.volumeId[ROVOL];
+       strcpy(vname, entry.name);
+       strcat(vname, ".readonly");
+
+       if (roclone) {
+           /* have to clear flags to ensure new vol goes online
+            */
+           code = AFSVolSetFlags(fromconn, fromtid, 0);
+           if (code && (code != ENOENT)) {
+               PrintError("Failed to set flags on ro volume: ",
+                          code);
+           }
+
+           VPRINT3("%sloning to permanent RO %u on %s...", roexists?"Re-c":"C", tmpVol,
+                   noresolve ?
+                   afs_inet_ntoa_r(entry.serverNumber[roindex],
+                                   hoststr) :
+                   hostutil_GetNameByINet(entry.serverNumber[roindex]));
+
+           code = AFSVolClone(fromconn, fromtid, roexists?tmpVol:0,
+                              readonlyVolume, vname, &tmpVol);
+
+           if (!code) {
+               VDONE;
+               VPRINT("Bringing readonly online...");
+               code = DoVolOnline(&entry, tmpVol, roindex, vname,
+                                  fromconn);
+           }
+           if (code) {
+               EPRINT(code, "Failed: ");
+               entry.serverFlags[roindex] &= ~NEW_REPSITE;
+               entry.serverFlags[roindex] |= RO_DONTUSE;
+           } else {
+               entry.serverFlags[roindex] |= NEW_REPSITE;
+               entry.serverFlags[roindex] &= ~RO_DONTUSE;
+               entry.flags |= RO_EXISTS;
+               VDONE;
+           }
+
+       }
        for (s = 0; s < volcount; s++) {
-           if (replicas[s].trans)
+           if (replicas[s].trans) {
+               vldbindex = times[s].vldbEntryIndex;
+
+               /* ok, so now we have to end the previous transaction */
                code = AFSVolEndTrans(toconns[s], replicas[s].trans, &rcode);
-           replicas[s].trans = 0;
-           if (!code)
-               code = rcode;
-           if (code) {
-               if ((s == 0) || (code != ENOENT)) {
-                   PrintError("Could not end transaction on a ro volume: ",
-                              code);
+               if (!code)
+                   code = rcode;
+
+               if (!code) {
+                   code = AFSVolTransCreate_retry(toconns[s],
+                                                  cloneVolId,
+                                                  entry.serverPartition[vldbindex],
+                                                  ITBusy,
+                                                  &(replicas[s].trans));
+                   if (code) {
+                       PrintError("Unable to begin transaction on temporary clone: ", code);
+                   }
                } else {
-                   PrintError
-                       ("Transaction timed out on a ro volume. Will retry.\n",
-                        0);
-                   if (times[s].vldbEntryIndex < vldbindex)
-                       vldbindex = times[s].vldbEntryIndex;
+                   PrintError("Unable to end transaction on temporary clone: ", code);
                }
-           }
 
-           if (toconns[s])
-               rx_DestroyConnection(toconns[s]);
-           toconns[s] = 0;
+               VPRINT3("%sloning to permanent RO %u on %s...", times[s].crtime?"Re-c":"C",
+                       tmpVol, noresolve ?
+                       afs_inet_ntoa_r(htonl(replicas[s].server.destHost),
+                                       hoststr) :
+                       hostutil_GetNameByINet(htonl(replicas[s].server.destHost)));
+               if (times[s].crtime)
+                   code = AFSVolClone(toconns[s], replicas[s].trans, tmpVol,
+                                      readonlyVolume, vname, &tmpVol);
+               else
+                   code = AFSVolClone(toconns[s], replicas[s].trans, 0,
+                                      readonlyVolume, vname, &tmpVol);
+
+               if (code) {
+                   if (!times[s].crtime) {
+                       entry.serverFlags[vldbindex] |= RO_DONTUSE;
+                   }
+                   entry.serverFlags[vldbindex] &= ~NEW_REPSITE;
+                   PrintError("Failed: ",
+                              code);
+               } else
+                   VDONE;
+
+               if (entry.serverFlags[vldbindex] != RO_DONTUSE) {
+                   /* bring it online (mark it InService) */
+                   VPRINT1("Bringing readonly online on %s...",
+                           noresolve ?
+                           afs_inet_ntoa_r(
+                               htonl(replicas[s].server.destHost),
+                               hoststr) :
+                           hostutil_GetNameByINet(
+                               htonl(replicas[s].server.destHost)));
+
+                   code = DoVolOnline(&entry, tmpVol, vldbindex, vname,
+                                      toconns[s]);
+                   /* needed to come online for cloning */
+                   if (code) {
+                       /* technically it's still new, just not online */
+                       entry.serverFlags[s] &= ~NEW_REPSITE;
+                       entry.serverFlags[s] |= RO_DONTUSE;
+                       if (code != ENOENT) {
+                           PrintError("Failed to set correct names and ids: ",
+                                      code);
+                       }
+                   } else
+                       VDONE;
+               }
+
+               VPRINT("Marking temporary clone for deletion...\n");
+               code = AFSVolSetFlags(toconns[s],
+                                     replicas[s].trans,
+                                     VTDeleteOnSalvage |
+                                     VTOutOfService);
+               if (code)
+                 EPRINT(code, "Failed: ");
+               else
+                 VDONE;
+
+               VPRINT("Ending transaction on temporary clone...\n");
+               code = AFSVolEndTrans(toconns[s], replicas[s].trans, &rcode);
+               if (!code)
+                   rcode = code;
+               if (code)
+                   PrintError("Failed: ", code);
+               else {
+                   VDONE;
+                   /* ended successfully */
+                   replicas[s].trans = 0;
+
+                   VPRINT2("Deleting temporary clone %u on %s...", cloneVolId,
+                           noresolve ?
+                           afs_inet_ntoa_r(htonl(replicas[s].server.destHost),
+                                           hoststr) :
+                           hostutil_GetNameByINet(htonl(replicas[s].server.destHost)));
+                   code = DoVolDelete(toconns[s], cloneVolId,
+                                      entry.serverPartition[vldbindex],
+                                      NULL, 0, NULL, NULL);
+                   if (code) {
+                       EPRINT(code, "Failed: ");
+                   } else
+                       VDONE;
+               }
+           }
        }
 
-       MapNetworkToHostU(&entry, &storeEntry);
-       vcode = VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry, 0);
-       ONERROR(vcode, afromvol,
-               " Could not update VLDB entry for volume %u\n");
-    }                          /* for each index in the vldb */
+       /* done. put the vldb entry in the success tail case*/
+       PutTrans(&vldbindex, replicas, toconns, times, volcount);
+    }
 
     /* End the transaction on the cloned volume */
     code = AFSVolEndTrans(fromconn, fromtid, &rcode);
@@ -4156,14 +4414,13 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
            if (!(entry.serverFlags[i] & NEW_REPSITE)) {
                MapPartIdIntoName(entry.serverPartition[i], pname);
                fprintf(STDERR, "\t%35s %s\n",
-                        noresolve ? afs_inet_ntoa_r(entry.serverUnique[i], hoststr) :
-                        hostutil_GetNameByINet(entry.serverUnique[i]), pname);
+                        noresolve ? afs_inet_ntoa_r(entry.serverNumber[i], hoststr) :
+                        hostutil_GetNameByINet(entry.serverNumber[i]), pname);
            }
        }
-
-       MapNetworkToHostU(&entry, &storeEntry);
+       MapNetworkToHost(&entry, &storeEntry);
        vcode =
-           VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry,
+           VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry,
                              LOCKREL_TIMESTAMP);
        ONERROR(vcode, afromvol,
                " Could not update VLDB entry for volume %u\n");
@@ -4171,18 +4428,19 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
        ERROREXIT(VOLSERBADRELEASE);
     }
 
+    entry.cloneId = 0;
     /* All the ROs were release successfully. Remove the temporary clone */
-    if (!roclone) {
+    if (!roclone || stayUp) {
        if (verbose) {
            fprintf(STDOUT, "Deleting the releaseClone %lu ...",
                    (unsigned long)cloneVolId);
            fflush(STDOUT);
        }
-       code = DelVol(fromconn, cloneVolId, afrompart, ITOffline);
+       code = DoVolDelete(fromconn, cloneVolId, afrompart, NULL, 0, NULL,
+                          NULL);
        ONERROR(code, cloneVolId, "Failed to delete volume %u.\n");
        VDONE;
     }
-    entry.cloneId = 0;
 
     for (i = 0; i < entry.nServers; i++)
        entry.serverFlags[i] &= ~NEW_REPSITE;
@@ -4190,9 +4448,9 @@ UV_ReleaseVolume(afs_uint32 afromvol, afs_uint32 afromserver,
     /* Update the VLDB */
     VPRINT("updating VLDB ...");
 
-    MapNetworkToHostU(&entry, &storeEntry);
+    MapNetworkToHost(&entry, &storeEntry);
     vcode =
-       VLDB_ReplaceEntryU(afromvol, RWVOL, &storeEntry,
+       VLDB_ReplaceEntry(afromvol, RWVOL, &storeEntry,
                          LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
     ONERROR(vcode, afromvol, " Could not update VLDB entry for volume %u\n");
     VDONE;
@@ -4294,7 +4552,7 @@ UV_DumpVolume(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
     struct rx_connection * volatile fromconn = NULL;
     afs_int32 volatile fromtid = 0;
 
-    afs_int32 rxError = 0, rcode = 0;
+    afs_int32 rcode = 0;
     afs_int32 code, error = 0;
     afs_int32 tmp;
     time_t tmv = fromdate;
@@ -4344,7 +4602,7 @@ UV_DumpVolume(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
 
   error_exit:
     if (fromcall) {
-       code = rx_EndCall(fromcall, rxError);
+       code = rx_EndCall(fromcall, 0);
        if (code && code != RXGEN_OPCODE)
            fprintf(STDERR, "Error in rx_EndCall\n");
        if (code && !error)
@@ -4389,7 +4647,7 @@ UV_DumpClonedVolume(afs_uint32 afromvol, afs_uint32 afromserver,
     afs_uint32 volatile clonevol = 0;
 
     afs_int32 tmp;
-    afs_int32 fromtid = 0, rxError = 0, rcode = 0;
+    afs_int32 fromtid = 0, rcode = 0;
     afs_int32 code = 0, error = 0;
     afs_uint32 tmpVol;
     char vname[64];
@@ -4497,7 +4755,7 @@ UV_DumpClonedVolume(afs_uint32 afromvol, afs_uint32 afromserver,
     }
 
     if (fromcall) {
-       code = rx_EndCall(fromcall, rxError);
+       code = rx_EndCall(fromcall, 0);
        if (code) {
            fprintf(STDERR, "Error in rx_EndCall\n");
            if (!error)
@@ -4539,15 +4797,13 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
     struct rx_connection *toconn, *tempconn;
     struct rx_call *tocall;
     afs_int32 totid, code, rcode, vcode, terror = 0;
-    afs_int32 rxError = 0;
     struct volser_status tstatus;
     struct volintInfo vinfo;
     char partName[10];
     char tovolreal[VOLSER_OLDMAXVOLNAME];
     afs_uint32 pvolid;
     afs_int32 temptid, pparentid;
-    int success;
-    struct uvldbentry entry, storeEntry;
+    struct nvldbentry entry, storeEntry;
     afs_int32 error;
     int islocked;
     struct restoreCookie cookie;
@@ -4560,11 +4816,9 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
 
     memset(&cookie, 0, sizeof(cookie));
     islocked = 0;
-    success = 0;
     error = 0;
     reuseID = 1;
     tocall = (struct rx_call *)0;
-    toconn = (struct rx_connection *)0;
     tempconn = (struct rx_connection *)0;
     totid = 0;
     temptid = 0;
@@ -4581,7 +4835,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
     pparentid = toparentid;
     toconn = UV_Bind(toserver, AFSCONF_VOLUMEPORT);
     if (pvolid == 0) {         /*alot a new id if needed */
-       vcode = VLDB_GetEntryByNameU(tovolname, &entry);
+       vcode = VLDB_GetEntryByName(tovolname, &entry);
        if (vcode == VL_NOENT) {
            vcode = ubik_VL_GetNewVolumeId(cstruct, 0, 1, &pvolid);
            if (vcode) {
@@ -4641,36 +4895,12 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
                           &totid);
     if (code) {
        if (flags & RV_FULLRST) {       /* full restore: delete then create anew */
-           VPRINT1("Deleting the previous volume %u ...", pvolid);
-
-           code =
-               AFSVolTransCreate_retry(toconn, pvolid, topart, ITOffline, &totid);
-           EGOTO1(refail, code, "Failed to start transaction on %u\n",
-                  pvolid);
-
-           code = AFSVolGetStatus(toconn, totid, &tstatus);
-           EGOTO1(refail, code, "Could not get timestamp from volume %u\n",
-                  pvolid);
-
-           oldCreateDate = tstatus.creationDate;
-           oldUpdateDate = tstatus.updateDate;
-
-           code =
-               AFSVolSetFlags(toconn, totid,
-                              VTDeleteOnSalvage | VTOutOfService);
-           EGOTO1(refail, code, "Could not set flags on volume %u \n",
-                  pvolid);
-
-           code = AFSVolDeleteVolume(toconn, totid);
-           EGOTO1(refail, code, "Could not delete volume %u\n", pvolid);
-
-           code = AFSVolEndTrans(toconn, totid, &rcode);
-           totid = 0;
-           if (!code)
-               code = rcode;
-           EGOTO1(refail, code, "Could not end transaction on %u\n", pvolid);
-
-           VDONE;
+           code = DoVolDelete(toconn, pvolid, topart, "the previous", 0,
+                              &tstatus, NULL);
+           if (code && code != VNOVOL) {
+               error = code;
+               goto refail;
+           }
 
            code =
                AFSVolCreateVolume(toconn, topart, tovolreal, volsertype, pparentid,
@@ -4686,9 +4916,9 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
            EGOTO1(refail, code, "Could not get timestamp from volume %u\n",
                   pvolid);
 
-           oldCreateDate = tstatus.creationDate;
-           oldUpdateDate = tstatus.updateDate;
        }
+       oldCreateDate = tstatus.creationDate;
+       oldUpdateDate = tstatus.updateDate;
     } else {
        oldCreateDate = 0;
        oldUpdateDate = 0;
@@ -4712,7 +4942,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
        error = code;
        goto refail;
     }
-    terror = rx_EndCall(tocall, rxError);
+    terror = rx_EndCall(tocall, 0);
     tocall = (struct rx_call *)0;
     if (terror) {
        fprintf(STDERR, "rx_EndCall Failed \n");
@@ -4785,14 +5015,13 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
        goto refail;
     }
 
-    success = 1;
     fprintf(STDOUT, " done\n");
     fflush(STDOUT);
-    if (success && (!reuseID || (flags & RV_FULLRST))) {
+    if (!reuseID || (flags & RV_FULLRST)) {
        /* Volume was restored on the file server, update the
         * VLDB to reflect the change.
         */
-       vcode = VLDB_GetEntryByIDU(pvolid, voltype, &entry);
+       vcode = VLDB_GetEntryByID(pvolid, voltype, &entry);
        if (vcode && vcode != VL_NOENT && vcode != VL_ENTDELETED) {
            fprintf(STDERR,
                    "Could not fetch the entry for volume number %lu from VLDB \n",
@@ -4801,13 +5030,13 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
            goto refail;
        }
        if (!vcode)
-           MapHostToNetworkU(&entry);
+           MapHostToNetwork(&entry);
        if (vcode == VL_NOENT) {        /* it doesnot exist already */
            /*make the vldb return this indication specifically */
            VPRINT("------- Creating a new VLDB entry ------- \n");
            strcpy(entry.name, tovolname);
            entry.nServers = 1;
-           entry.serverUnique[0] = toserver;   /*should be indirect */
+           entry.serverNumber[0] = toserver;   /*should be indirect */
            entry.serverPartition[0] = topart;
            entry.serverFlags[0] = (flags & RV_RDONLY) ? ITSROVOL : ITSRWVOL;
            entry.flags = (flags & RV_RDONLY) ? RO_EXISTS : RW_EXISTS;
@@ -4824,8 +5053,8 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
                /*this should come from status info on the volume if non zero */
            } else
                entry.volumeId[BACKVOL] = INVALID_BID;
-           MapNetworkToHostU(&entry, &storeEntry);
-           vcode = VLDB_CreateEntryU(&storeEntry);
+           MapNetworkToHost(&entry, &storeEntry);
+           vcode = VLDB_CreateEntry(&storeEntry);
            if (vcode) {
                fprintf(STDERR,
                        "Could not create the VLDB entry for volume number %lu  \n",
@@ -4835,12 +5064,12 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
            }
            islocked = 0;
            if (verbose)
-               EnumerateEntryU(&entry);
+               EnumerateEntry(&entry);
        } else {                /*update the existing entry */
            if (verbose) {
                fprintf(STDOUT, "Updating the existing VLDB entry\n");
                fprintf(STDOUT, "------- Old entry -------\n");
-               EnumerateEntryU(&entry);
+               EnumerateEntry(&entry);
                fprintf(STDOUT, "------- New entry -------\n");
            }
            vcode =
@@ -4858,12 +5087,12 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
 
            /* Update the vlentry with the new information */
            if (flags & RV_RDONLY)
-               index = Lp_ROMatchU(toserver, topart, &entry) - 1;
+               index = Lp_ROMatch(toserver, topart, &entry) - 1;
            else
-               index = Lp_GetRwIndexU(&entry);
+               index = Lp_GetRwIndex(&entry);
            if (index == -1) {
                /* Add the new site for the volume being restored */
-               entry.serverUnique[entry.nServers] = toserver;
+               entry.serverNumber[entry.nServers] = toserver;
                entry.serverPartition[entry.nServers] = topart;
                entry.serverFlags[entry.nServers] =
                    (flags & RV_RDONLY) ? ITSROVOL : ITSRWVOL;
@@ -4873,7 +5102,7 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
                 * if its different from new site.
                 */
                same =
-                   VLDB_IsSameAddrs(toserver, entry.serverUnique[index],
+                   VLDB_IsSameAddrs(toserver, entry.serverNumber[index],
                                     &errcode);
                if (errcode)
                    EPRINT2(errcode,
@@ -4885,11 +5114,11 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
                        VPRINT2
                            ("Not deleting the previous volume %u on server %s, ...",
                             pvolid,
-                             noresolve ? afs_inet_ntoa_r(entry.serverUnique[index], hoststr) :
-                            hostutil_GetNameByINet(entry.serverUnique[index]));
+                             noresolve ? afs_inet_ntoa_r(entry.serverNumber[index], hoststr) :
+                            hostutil_GetNameByINet(entry.serverNumber[index]));
                    } else {
                        tempconn =
-                           UV_Bind(entry.serverUnique[index],
+                           UV_Bind(entry.serverNumber[index],
                                    AFSCONF_VOLUMEPORT);
 
                        MapPartIdIntoName(entry.serverPartition[index],
@@ -4897,58 +5126,28 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
                        VPRINT3
                            ("Deleting the previous volume %u on server %s, partition %s ...",
                             pvolid,
-                             noresolve ? afs_inet_ntoa_r(entry.serverUnique[index], hoststr) :
-                            hostutil_GetNameByINet(entry.serverUnique[index]),
+                             noresolve ? afs_inet_ntoa_r(entry.serverNumber[index], hoststr) :
+                            hostutil_GetNameByINet(entry.serverNumber[index]),
                             apartName);
-                       code =
-                           AFSVolTransCreate_retry(tempconn, pvolid,
-                                             entry.serverPartition[index],
-                                             ITOffline, &temptid);
-                       if (!code) {
-                           code =
-                               AFSVolSetFlags(tempconn, temptid,
-                                              VTDeleteOnSalvage |
-                                              VTOutOfService);
-                           if (code) {
-                               fprintf(STDERR,
-                                       "Could not set flags on volume %lu on the older site\n",
-                                       (unsigned long)pvolid);
-                               error = code;
-                               goto refail;
-                           }
-                           code = AFSVolDeleteVolume(tempconn, temptid);
-                           if (code) {
-                               fprintf(STDERR,
-                                       "Could not delete volume %lu on the older site\n",
-                                       (unsigned long)pvolid);
-                               error = code;
-                               goto refail;
-                           }
-                           code = AFSVolEndTrans(tempconn, temptid, &rcode);
-                           temptid = 0;
-                           if (!code)
-                               code = rcode;
-                           if (code) {
-                               fprintf(STDERR,
-                                       "Could not end transaction on volume %lu on the older site\n",
-                                       (unsigned long)pvolid);
-                               error = code;
-                               goto refail;
-                           }
-                           VDONE;
-                           MapPartIdIntoName(entry.serverPartition[index],
-                                             partName);
+                       code = DoVolDelete(tempconn, pvolid,
+                                          entry.serverPartition[index],
+                                          "the", 0, NULL, NULL);
+                       if (code && code != VNOVOL) {
+                           error = code;
+                           goto refail;
                        }
+                       MapPartIdIntoName(entry.serverPartition[index],
+                                         partName);
                    }
                }
-               entry.serverUnique[index] = toserver;
+               entry.serverNumber[index] = toserver;
                entry.serverPartition[index] = topart;
            }
 
            entry.flags |= (flags & RV_RDONLY) ? RO_EXISTS : RW_EXISTS;
-           MapNetworkToHostU(&entry, &storeEntry);
+           MapNetworkToHost(&entry, &storeEntry);
            vcode =
-               VLDB_ReplaceEntryU(pvolid, voltype, &storeEntry,
+               VLDB_ReplaceEntry(pvolid, voltype, &storeEntry,
                                  LOCKREL_OPCODE | LOCKREL_AFSID |
                                  LOCKREL_TIMESTAMP);
            if (vcode) {
@@ -4960,14 +5159,14 @@ UV_RestoreVolume2(afs_uint32 toserver, afs_int32 topart, afs_uint32 tovolid,
            }
            islocked = 0;
            if (verbose)
-               EnumerateEntryU(&entry);
+               EnumerateEntry(&entry);
        }
 
 
     }
   refail:
     if (tocall) {
-       code = rx_EndCall(tocall, rxError);
+       code = rx_EndCall(tocall, 0);
        if (!error)
            error = code;
     }
@@ -5061,7 +5260,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
            afs_uint32 rovolid, afs_int32 valid)
 {
     int j, nro = 0, islocked = 0;
-    struct uvldbentry entry, storeEntry, entry2;
+    struct nvldbentry entry, storeEntry, entry2;
     afs_int32 vcode, error = 0;
     char apartName[10];
 
@@ -5074,7 +5273,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
     }
     islocked = 1;
 
-    error = VLDB_GetEntryByIDU(volid, RWVOL, &entry);
+    error = VLDB_GetEntryByID(volid, RWVOL, &entry);
     if (error) {
        fprintf(STDERR,
                "Could not fetch the VLDB entry for volume number %lu  \n",
@@ -5089,7 +5288,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
        error = VOLSERBADOP;
        goto asfail;
     }
-    MapHostToNetworkU(&entry);
+    MapHostToNetwork(&entry);
 
     /* See if it's too many entries */
     if (entry.nServers >= NMAXNSERVERS) {
@@ -5103,7 +5302,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
     for (j = 0; j < entry.nServers; j++) {
        if (entry.serverFlags[j] & ITSROVOL) {
            nro++;
-           if (VLDB_IsSameAddrs(server, entry.serverUnique[j], &error)) {
+           if (VLDB_IsSameAddrs(server, entry.serverNumber[j], &error)) {
                if (error) {
                    fprintf(STDERR,
                            "Failed to get info about server's %d address(es) from vlserver (err=%d); aborting call!\n",
@@ -5134,7 +5333,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
      */
     if (rovolid) {
        if (entry.volumeId[ROVOL] == INVALID_BID) {
-           vcode = VLDB_GetEntryByIDU(rovolid, -1, &entry2);
+           vcode = VLDB_GetEntryByID(rovolid, -1, &entry2);
            if (!vcode) {
                fprintf(STDERR, "Volume ID %d already exists\n", rovolid);
                return VVOLEXISTS;
@@ -5148,7 +5347,7 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
     }
 
     VPRINT("Adding a new site ...");
-    entry.serverUnique[entry.nServers] = server;
+    entry.serverNumber[entry.nServers] = server;
     entry.serverPartition[entry.nServers] = part;
     if (!valid) {
        entry.serverFlags[entry.nServers] = (ITSROVOL | RO_DONTUSE);
@@ -5157,9 +5356,9 @@ UV_AddSite2(afs_uint32 server, afs_int32 part, afs_uint32 volid,
     }
     entry.nServers++;
 
-    MapNetworkToHostU(&entry, &storeEntry);
+    MapNetworkToHost(&entry, &storeEntry);
     error =
-       VLDB_ReplaceEntryU(volid, RWVOL, &storeEntry,
+       VLDB_ReplaceEntry(volid, RWVOL, &storeEntry,
                          LOCKREL_OPCODE | LOCKREL_AFSID | LOCKREL_TIMESTAMP);
     if (error) {
        fprintf(STDERR, "Could not update entry for volume %lu \n",
@@ -5191,7 +5390,7 @@ int
 UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid)
 {
     afs_int32 vcode;
-    struct uvldbentry entry, storeEntry;
+    struct nvldbentry entry, storeEntry;
 
     vcode = ubik_VL_SetLock(cstruct, 0, volid, RWVOL, VLOP_ADDSITE);
     if (vcode) {
@@ -5200,7 +5399,7 @@ UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid)
        PrintError("", vcode);
        return (vcode);
     }
-    vcode = VLDB_GetEntryByIDU(volid, RWVOL, &entry);
+    vcode = VLDB_GetEntryByID(volid, RWVOL, &entry);
     if (vcode) {
        fprintf(STDERR,
                "Could not fetch the entry for volume number %lu from VLDB \n",
@@ -5208,8 +5407,8 @@ UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid)
        PrintError("", vcode);
        return (vcode);
     }
-    MapHostToNetworkU(&entry);
-    if (!Lp_ROMatchU(server, part, &entry)) {
+    MapHostToNetwork(&entry);
+    if (!Lp_ROMatch(server, part, &entry)) {
        /*this site doesnot exist  */
        fprintf(STDERR, "This site is not a replication site \n");
        vcode =
@@ -5225,7 +5424,7 @@ UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid)
        }
        return VOLSERBADOP;
     } else {                   /*remove the rep site */
-       Lp_SetROValueU(&entry, server, part, 0, 0);
+       Lp_SetROValue(&entry, server, part, 0, 0);
        entry.nServers--;
        if ((entry.nServers == 1) && (entry.flags & RW_EXISTS))
            entry.flags &= ~RO_EXISTS;
@@ -5242,12 +5441,12 @@ UV_RemoveSite(afs_uint32 server, afs_int32 part, afs_uint32 volid)
            }
            VDONE;
        }
-       MapNetworkToHostU(&entry, &storeEntry);
+       MapNetworkToHost(&entry, &storeEntry);
        fprintf(STDOUT, "Deleting the replication site for volume %lu ...",
                (unsigned long)volid);
        fflush(STDOUT);
        vcode =
-           VLDB_ReplaceEntryU(volid, RWVOL, &storeEntry,
+           VLDB_ReplaceEntry(volid, RWVOL, &storeEntry,
                              LOCKREL_OPCODE | LOCKREL_AFSID |
                              LOCKREL_TIMESTAMP);
        if (vcode) {
@@ -5269,7 +5468,7 @@ int
 UV_ChangeLocation(afs_uint32 server, afs_int32 part, afs_uint32 volid)
 {
     afs_int32 vcode;
-    struct uvldbentry entry, storeEntry;
+    struct nvldbentry entry, storeEntry;
     int index;
 
     vcode = ubik_VL_SetLock(cstruct, 0, volid, RWVOL, VLOP_ADDSITE);
@@ -5279,7 +5478,7 @@ UV_ChangeLocation(afs_uint32 server, afs_int32 part, afs_uint32 volid)
        PrintError("", vcode);
        return (vcode);
     }
-    vcode = VLDB_GetEntryByIDU(volid, RWVOL, &entry);
+    vcode = VLDB_GetEntryByID(volid, RWVOL, &entry);
     if (vcode) {
        fprintf(STDERR,
                "Could not fetch the entry for volume number %lu from VLDB \n",
@@ -5287,8 +5486,8 @@ UV_ChangeLocation(afs_uint32 server, afs_int32 part, afs_uint32 volid)
        PrintError("", vcode);
        return (vcode);
     }
-    MapHostToNetworkU(&entry);
-    index = Lp_GetRwIndexU(&entry);
+    MapHostToNetwork(&entry);
+    index = Lp_GetRwIndex(&entry);
     if (index < 0) {
        /* no RW site exists  */
        fprintf(STDERR, "No existing RW site for volume %lu",
@@ -5305,11 +5504,11 @@ UV_ChangeLocation(afs_uint32 server, afs_int32 part, afs_uint32 volid)
        }
        return VOLSERBADOP;
     } else {                   /* change the RW site */
-       entry.serverUnique[index] = server;
+       entry.serverNumber[index] = server;
        entry.serverPartition[index] = part;
-       MapNetworkToHostU(&entry, &storeEntry);
+       MapNetworkToHost(&entry, &storeEntry);
        vcode =
-           VLDB_ReplaceEntryU(volid, RWVOL, &storeEntry,
+           VLDB_ReplaceEntry(volid, RWVOL, &storeEntry,
                              LOCKREL_OPCODE | LOCKREL_AFSID |
                              LOCKREL_TIMESTAMP);
        if (vcode) {
@@ -5392,30 +5591,20 @@ UV_ZapVolumeClones(afs_uint32 aserver, afs_int32 apart,
     struct volDescription *curPtr;
     int curPos;
     afs_int32 code = 0;
-    afs_int32 rcode = 0;
     afs_int32 success = 1;
-    afs_int32 tid;
 
-    aconn = (struct rx_connection *)0;
     aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
     curPos = 0;
     for (curPtr = volPtr; curPos < arraySize; curPtr++) {
        if (curPtr->volFlags & CLONEVALID) {
            curPtr->volFlags &= ~CLONEZAPPED;
            success = 1;
-           code =
-               AFSVolTransCreate_retry(aconn, curPtr->volCloneId, apart, ITOffline,
-                                 &tid);
+
+           code = DoVolDelete(aconn, curPtr->volCloneId, apart,
+                              "clone", 0, NULL, NULL);
            if (code)
                success = 0;
-           else {
-               code = AFSVolDeleteVolume(aconn, tid);
-               if (code)
-                   success = 0;
-               code = AFSVolEndTrans(aconn, tid, &rcode);
-               if (code || rcode)
-                   success = 0;
-           }
+
            if (success)
                curPtr->volFlags |= CLONEZAPPED;
            if (!success)
@@ -5425,7 +5614,6 @@ UV_ZapVolumeClones(afs_uint32 aserver, afs_int32 apart,
                VPRINT2("Clone of %s %u deleted\n", curPtr->volName,
                        curPtr->volCloneId);
            curPos++;
-           tid = 0;
        }
     }
     if (aconn)
@@ -5449,7 +5637,6 @@ UV_GenerateVolumeClones(afs_uint32 aserver, afs_int32 apart,
     afs_uint32 curCloneId = 0;
     char cloneName[256];       /*max vol name */
 
-    aconn = (struct rx_connection *)0;
     aconn = UV_Bind(aserver, AFSCONF_VOLUMEPORT);
     curPos = 0;
     if ((volPtr->volFlags & REUSECLONEID) && (volPtr->volFlags & ENTRYVALID))
@@ -5601,7 +5788,6 @@ UV_XListVolumes(afs_uint32 a_serverID, afs_int32 a_partID, int a_all,
      * We set the val field to a null pointer as a hint for the stub to
      * allocate space.
      */
-    code = 0;
     *a_numEntsInResultP = 0;
     *a_resultPP = (volintXInfo *) 0;
     volumeXInfo.volXEntries_val = (volintXInfo *) 0;
@@ -5643,8 +5829,6 @@ UV_ListOneVolume(afs_uint32 aserver, afs_int32 apart, afs_uint32 volid,
     afs_int32 code = 0;
     volEntries volumeInfo;
 
-    code = 0;
-
     *resultPtr = (volintInfo *) 0;
     volumeInfo.volEntries_val = (volintInfo *) 0;      /*this hints the stub to allocate space */
     volumeInfo.volEntries_len = 0;
@@ -5707,7 +5891,6 @@ UV_XListOneVolume(afs_uint32 a_serverID, afs_int32 a_partID, afs_uint32 a_volID,
      * the info.  Setting the val field to a null pointer tells the stub
      * to allocate space for us.
      */
-    code = 0;
     *a_resultPP = (volintXInfo *) 0;
     volumeXInfo.volXEntries_val = (volintXInfo *) 0;
     volumeXInfo.volXEntries_len = 0;
@@ -5759,12 +5942,12 @@ UV_XListOneVolume(afs_uint32 a_serverID, afs_int32 a_partID, afs_uint32 a_volID,
 static afs_int32
 CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
            afs_int32 * modentry, afs_uint32 * maxvolid,
-            struct uvldbentry *aentry)
+            struct nvldbentry *aentry)
 {
     int idx = 0;
     int j;
     afs_int32 code, error = 0;
-    struct uvldbentry entry, storeEntry;
+    struct nvldbentry entry, storeEntry;
     char pname[10];
     int pass = 0, createentry, addvolume, modified, mod, doit = 1;
     afs_uint32 rwvolid;
@@ -5801,11 +5984,11 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
        memcpy(&entry, aentry, sizeof(entry));
     } else {
        /* Read the entry from VLDB by its RW volume id */
-       code = VLDB_GetEntryByIDU(rwvolid, RWVOL, &entry);
+       code = VLDB_GetEntryByID(rwvolid, RWVOL, &entry);
        if (code) {
            if (code != VL_NOENT) {
                fprintf(STDOUT,
-                       "Could not retreive the VLDB entry for volume %lu \n",
+                       "Could not retrieve the VLDB entry for volume %lu \n",
                        (unsigned long)rwvolid);
                ERROR_EXIT(code);
            }
@@ -5815,7 +5998,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
 
            createentry = 1;
        } else {
-           MapHostToNetworkU(&entry);
+           MapHostToNetwork(&entry);
        }
     }
 
@@ -5827,7 +6010,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
        } else {
            if ((entry.flags & RW_EXISTS) || (entry.flags & RO_EXISTS)
                || (entry.flags & BACK_EXISTS))
-               EnumerateEntryU(&entry);
+               EnumerateEntry(&entry);
        }
        fprintf(STDOUT, "\n");
     }
@@ -5845,14 +6028,14 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
            if (mod)
                modified++;
 
-           idx = Lp_GetRwIndexU(&entry);
+           idx = Lp_GetRwIndex(&entry);
            if (idx == -1) {    /* RW index not found in the VLDB entry */
                idx = entry.nServers;   /* put it into next index */
                entry.nServers++;
                addvolume++;
            } else {            /* RW index found in the VLDB entry. */
                /* Verify if this volume's location matches where the VLDB says it is */
-               if (!Lp_MatchU(aserver, apart, &entry)) {
+               if (!Lp_Match(aserver, apart, &entry)) {
                    if (entry.flags & RW_EXISTS) {
                        /* The RW volume exists elsewhere - report this one a duplicate */
                        if (pass == 1) {
@@ -5868,10 +6051,10 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
                            fprintf(STDERR,
                                    "    VLDB reports RW volume %lu exists on %s %s\n",
                                    (unsigned long)rwvolid,
-                                    noresolve ? 
-                                    afs_inet_ntoa_r(entry.serverUnique[idx], hoststr) :
+                                    noresolve ?
+                                    afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) :
                                    hostutil_GetNameByINet(entry.
-                                                          serverUnique[idx]),
+                                                          serverNumber[idx]),
                                    pname);
                        }
                    } else {
@@ -5887,9 +6070,9 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
                                        "*** Warning: Orphaned BK volume %u exists on %s %s\n",
                                        entry.volumeId[BACKVOL],
                                         noresolve ?
-                                        afs_inet_ntoa_r(entry.serverUnique[idx], hoststr) :
+                                        afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) :
                                        hostutil_GetNameByINet(entry.
-                                                              serverUnique
+                                                              serverNumber
                                                               [idx]), pname);
                                MapPartIdIntoName(apart, pname);
                                fprintf(STDERR,
@@ -5925,7 +6108,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
                entry.volumeId[ROVOL] = volumeinfo->cloneID;
 
            entry.serverFlags[idx] = ITSRWVOL;
-           entry.serverUnique[idx] = aserver;
+           entry.serverNumber[idx] = aserver;
            entry.serverPartition[idx] = apart;
            strncpy(entry.name, volumeinfo->name, VOLSER_OLDMAXVOLNAME);
 
@@ -5953,14 +6136,14 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
            if (mod)
                modified++;
 
-           idx = Lp_GetRwIndexU(&entry);
+           idx = Lp_GetRwIndex(&entry);
            if (idx == -1) {    /* RW index not found in the VLDB entry */
                idx = entry.nServers;   /* Put it into next index */
                entry.nServers++;
                addvolume++;
            } else {            /* RW index found in the VLDB entry */
                /* Verify if this volume's location matches where the VLDB says it is */
-               if (!Lp_MatchU(aserver, apart, &entry)) {
+               if (!Lp_Match(aserver, apart, &entry)) {
                    /* VLDB says RW and/or BK is elsewhere - report this BK volume orphaned */
                    if (pass == 1) {
                        MapPartIdIntoName(apart, pname);
@@ -5975,9 +6158,9 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
                                "    VLDB reports its RW/BK volume %lu exists on %s %s\n",
                                (unsigned long)rwvolid,
                                 noresolve ?
-                                afs_inet_ntoa_r(entry.serverUnique[idx], hoststr) :
+                                afs_inet_ntoa_r(entry.serverNumber[idx], hoststr) :
                                hostutil_GetNameByINet(entry.
-                                                      serverUnique[idx]),
+                                                      serverNumber[idx]),
                                pname);
                    }
                } else {
@@ -6029,7 +6212,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
            entry.volumeId[RWVOL] = rwvolid;
            entry.volumeId[BACKVOL] = volumeinfo->volid;
 
-           entry.serverUnique[idx] = aserver;
+           entry.serverNumber[idx] = aserver;
            entry.serverPartition[idx] = apart;
            entry.serverFlags[idx] = ITSBACKVOL;
 
@@ -6043,7 +6226,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
             * VLDB so we avoid the CheckVldbRO() call (which checks if each
             * RO volume listed in the VLDB exists).
             */
-           idx = Lp_ROMatchU(aserver, apart, &entry) - 1;
+           idx = Lp_ROMatch(aserver, apart, &entry) - 1;
            if (idx == -1) {
                idx = entry.nServers;
                entry.nServers++;
@@ -6082,16 +6265,16 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
                                    "*** Warning: Orphaned RO volume %u exists on %s %s\n",
                                    entry.volumeId[ROVOL],
                                     noresolve ?
-                                    afs_inet_ntoa_r(entry.serverUnique[j], hoststr) :
+                                    afs_inet_ntoa_r(entry.serverNumber[j], hoststr) :
                                     hostutil_GetNameByINet(entry.
-                                                          serverUnique[j]),
+                                                          serverNumber[j]),
                                    pname);
                            fprintf(STDERR,
                                    "    VLDB reports its RO volume ID is %lu\n",
                                    (unsigned long)volumeinfo->volid);
                        }
 
-                       Lp_SetRWValueU(&entry, entry.serverUnique[idx],
+                       Lp_SetRWValue(&entry, entry.serverNumber[idx],
                                      entry.serverPartition[idx], 0L, 0L);
                        entry.nServers--;
                        modified++;
@@ -6123,7 +6306,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
                 * and there exist RO volumes in the VLDB entry. See if any of them
                 * are this one. If not, then we add it.
                 */
-               idx = Lp_ROMatchU(aserver, apart, &entry) - 1;
+               idx = Lp_ROMatch(aserver, apart, &entry) - 1;
                if (idx == -1) {
                    idx = entry.nServers;
                    entry.nServers++;
@@ -6137,7 +6320,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
            entry.volumeId[RWVOL] = rwvolid;
            entry.volumeId[ROVOL] = volumeinfo->volid;
 
-           entry.serverUnique[idx] = aserver;
+           entry.serverNumber[idx] = aserver;
            entry.serverPartition[idx] = apart;
            entry.serverFlags[idx] = ITSROVOL;
 
@@ -6154,10 +6337,10 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
        *maxvolid = entry.volumeId[RWVOL];
 
     if (modified && doit) {
-       MapNetworkToHostU(&entry, &storeEntry);
+       MapNetworkToHost(&entry, &storeEntry);
 
        if (createentry) {
-           code = VLDB_CreateEntryU(&storeEntry);
+           code = VLDB_CreateEntry(&storeEntry);
            if (code) {
                fprintf(STDOUT,
                        "Could not create a VLDB entry for the volume %lu\n",
@@ -6168,7 +6351,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
            if (pass == 1)
                goto retry;
            code =
-               VLDB_ReplaceEntryU(rwvolid, RWVOL, &storeEntry,
+               VLDB_ReplaceEntry(rwvolid, RWVOL, &storeEntry,
                                  LOCKREL_OPCODE | LOCKREL_AFSID |
                                  LOCKREL_TIMESTAMP);
            if (code) {
@@ -6197,7 +6380,7 @@ CheckVolume(volintInfo * volumeinfo, afs_uint32 aserver, afs_int32 apart,
     if (verbose) {
        fprintf(STDOUT, "-- status after --\n");
        if (modified)
-           EnumerateEntryU(&entry);
+           EnumerateEntry(&entry);
        else
            fprintf(STDOUT, "\n**no change**\n");
     }
@@ -6252,7 +6435,7 @@ UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags)
     afs_int32 j, k, code, vcode, error = 0;
     afs_int32 tverbose;
     afs_int32 mod, modified = 0, deleted = 0;
-    struct uvldbentry vldbentry;
+    struct nvldbentry vldbentry;
     afs_uint32 volumeid = 0;
     volEntries volumeInfo;
     struct partList PartList;
@@ -6276,13 +6459,13 @@ UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags)
     }
 
     /* Read the VLDB entry */
-    vcode = VLDB_GetEntryByNameU(avolname, &vldbentry);
+    vcode = VLDB_GetEntryByName(avolname, &vldbentry);
     if (vcode && (vcode != VL_NOENT)) {
        fprintf(STDERR, "Could not access the VLDB for volume %s\n",
                avolname);
        ERROR_EXIT(vcode);
     } else if (!vcode) {
-       MapHostToNetworkU(&vldbentry);
+       MapHostToNetwork(&vldbentry);
     }
 
     if (tverbose) {
@@ -6294,7 +6477,7 @@ UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags)
        } else {
            if ((vldbentry.flags & RW_EXISTS) || (vldbentry.flags & RO_EXISTS)
                || (vldbentry.flags & BACK_EXISTS))
-               EnumerateEntryU(&vldbentry);
+               EnumerateEntry(&vldbentry);
        }
        fprintf(STDOUT, "\n");
     }
@@ -6417,7 +6600,7 @@ UV_SyncVolume(afs_uint32 aserver, afs_int32 apart, char *avolname, int flags)
        if (deleted) {
            fprintf(STDOUT, "\n**entry deleted**\n");
        } else if (modified) {
-           EnumerateEntryU(&vldbentry);
+           EnumerateEntry(&vldbentry);
        } else {
            fprintf(STDOUT, "\n**no change**\n");
        }
@@ -6647,7 +6830,7 @@ VolumeExists(afs_uint32 server, afs_int32 partition, afs_uint32 volumeid)
  *
  */
 static afs_int32
-CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified)
+CheckVldbRWBK(struct nvldbentry * entry, afs_int32 * modified)
 {
     int modentry = 0;
     int idx;
@@ -6657,7 +6840,7 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified)
 
     if (modified)
        *modified = 0;
-    idx = Lp_GetRwIndexU(entry);
+    idx = Lp_GetRwIndex(entry);
 
     /* Check to see if the RW volume exists and set the RW_EXISTS
      * flag accordingly.
@@ -6669,7 +6852,7 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified)
        }
     } else {
        code =
-           VolumeExists(entry->serverUnique[idx],
+           VolumeExists(entry->serverNumber[idx],
                         entry->serverPartition[idx], entry->volumeId[RWVOL]);
        if (code == 0) {        /* RW volume exists */
            if (!(entry->flags & RW_EXISTS)) {  /* ... yet entry says RW does not exist */
@@ -6689,8 +6872,8 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified)
                        "Transaction call failed for RW volume %u on server %s %s\n",
                        entry->volumeId[RWVOL],
                         noresolve ?
-                        afs_inet_ntoa_r(entry->serverUnique[idx], hoststr) :
-                        hostutil_GetNameByINet(entry->serverUnique[idx]),
+                        afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) :
+                        hostutil_GetNameByINet(entry->serverNumber[idx]),
                        pname);
                ERROR_EXIT(code);
            }
@@ -6707,7 +6890,7 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified)
        }
     } else {                   /* Found a RW entry */
        code =
-           VolumeExists(entry->serverUnique[idx],
+           VolumeExists(entry->serverNumber[idx],
                         entry->serverPartition[idx],
                         entry->volumeId[BACKVOL]);
        if (code == 0) {        /* BK volume exists */
@@ -6728,8 +6911,8 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified)
                        "Transaction call failed for BK volume %u on server %s %s\n",
                        entry->volumeId[BACKVOL],
                         noresolve ?
-                        afs_inet_ntoa_r(entry->serverUnique[idx], hoststr) :
-                        hostutil_GetNameByINet(entry->serverUnique[idx]),
+                        afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) :
+                        hostutil_GetNameByINet(entry->serverNumber[idx]),
                        pname);
                ERROR_EXIT(code);
            }
@@ -6741,7 +6924,7 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified)
      */
     if ((idx != -1) && !(entry->flags & RW_EXISTS)
        && !(entry->flags & BACK_EXISTS)) {
-       Lp_SetRWValueU(entry, entry->serverUnique[idx],
+       Lp_SetRWValue(entry, entry->serverNumber[idx],
                      entry->serverPartition[idx], 0L, 0L);
        entry->nServers--;
        modentry++;
@@ -6753,8 +6936,8 @@ CheckVldbRWBK(struct uvldbentry * entry, afs_int32 * modified)
     return (error);
 }
 
-static int
-CheckVldbRO(struct uvldbentry *entry, afs_int32 * modified)
+static afs_int32
+CheckVldbRO(struct nvldbentry *entry, afs_int32 * modified)
 {
     int idx;
     int foundro = 0, modentry = 0;
@@ -6774,12 +6957,12 @@ CheckVldbRO(struct uvldbentry *entry, afs_int32 * modified)
        }
 
        code =
-           VolumeExists(entry->serverUnique[idx],
+           VolumeExists(entry->serverNumber[idx],
                         entry->serverPartition[idx], entry->volumeId[ROVOL]);
        if (code == 0) {        /* RO volume exists */
            foundro++;
        } else if (code == ENODEV) {    /* RW volume does not exist */
-           Lp_SetROValueU(entry, entry->serverUnique[idx],
+           Lp_SetROValue(entry, entry->serverNumber[idx],
                          entry->serverPartition[idx], 0L, 0L);
            entry->nServers--;
            idx--;
@@ -6790,8 +6973,8 @@ CheckVldbRO(struct uvldbentry *entry, afs_int32 * modified)
                    "Transaction call failed for RO %u on server %s %s\n",
                    entry->volumeId[ROVOL],
                     noresolve ?
-                    afs_inet_ntoa_r(entry->serverUnique[idx], hoststr) :
-                    hostutil_GetNameByINet(entry->serverUnique[idx]), pname);
+                    afs_inet_ntoa_r(entry->serverNumber[idx], hoststr) :
+                    hostutil_GetNameByINet(entry->serverNumber[idx]), pname);
            ERROR_EXIT(code);
        }
     }
@@ -6818,10 +7001,10 @@ CheckVldbRO(struct uvldbentry *entry, afs_int32 * modified)
  *      Ensure that <entry> matches with the info on file servers
  */
 static afs_int32
-CheckVldb(struct uvldbentry * entry, afs_int32 * modified, afs_int32 * deleted)
+CheckVldb(struct nvldbentry * entry, afs_int32 * modified, afs_int32 * deleted)
 {
     afs_int32 code, error = 0;
-    struct uvldbentry storeEntry;
+    struct nvldbentry storeEntry;
     int islocked = 0, mod, modentry, delentry = 0;
     int pass = 0, doit=1;
 
@@ -6835,7 +7018,7 @@ CheckVldb(struct uvldbentry * entry, afs_int32 * modified, afs_int32 * deleted)
        fprintf(STDOUT, "\n-- status before -- \n");
        if ((entry->flags & RW_EXISTS) || (entry->flags & RO_EXISTS)
            || (entry->flags & BACK_EXISTS))
-           EnumerateEntryU(entry);
+           EnumerateEntry(entry);
        fprintf(STDOUT, "\n");
     }
 
@@ -6860,13 +7043,13 @@ CheckVldb(struct uvldbentry * entry, afs_int32 * modified, afs_int32 * deleted)
        }
        islocked = 1;
 
-       code = VLDB_GetEntryByIDU(entry->volumeId[RWVOL], RWVOL, entry);
+       code = VLDB_GetEntryByID(entry->volumeId[RWVOL], RWVOL, entry);
        if (code) {
            fprintf(STDERR, "Could not read VLDB entry for volume %s\n",
                    entry->name);
            ERROR_EXIT(code);
        } else {
-           MapHostToNetworkU(entry);
+           MapHostToNetwork(entry);
        }
     }
 
@@ -6912,9 +7095,9 @@ CheckVldb(struct uvldbentry * entry, afs_int32 * modified, afs_int32 * deleted)
            delentry = 1;
        } else {
            /* Replace old entry with our new one */
-           MapNetworkToHostU(entry, &storeEntry);
+           MapNetworkToHost(entry, &storeEntry);
            code =
-               VLDB_ReplaceEntryU(entry->volumeId[RWVOL], RWVOL, &storeEntry,
+               VLDB_ReplaceEntry(entry->volumeId[RWVOL], RWVOL, &storeEntry,
                                  (LOCKREL_OPCODE | LOCKREL_AFSID |
                                   LOCKREL_TIMESTAMP));
            if (code) {
@@ -6938,7 +7121,7 @@ CheckVldb(struct uvldbentry * entry, afs_int32 * modified, afs_int32 * deleted)
        if (delentry)
            fprintf(STDOUT, "\n**entry deleted**\n");
        else if (modentry)
-           EnumerateEntryU(entry);
+           EnumerateEntry(entry);
        else
            fprintf(STDOUT, "\n**no change**\n");
     }
@@ -6972,9 +7155,9 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force)
     afs_int32 code, error = 0;
     afs_int32 nentries, tentries = 0;
     struct VldbListByAttributes attributes;
-    ubulkentries arrayEntries;
+    nbulkentries arrayEntries;
     afs_int32 failures = 0, modified, modifications = 0;
-    struct uvldbentry *vlentry;
+    struct nvldbentry *vlentry;
     afs_int32 si, nsi, j;
 
     if (flags & 2)
@@ -6998,10 +7181,10 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force)
 
        /* Collect set of VLDB entries */
        code =
-           VLDB_ListAttributesN2U(&attributes, 0, si, &nentries,
+           VLDB_ListAttributesN2(&attributes, 0, si, &nentries,
                                  &arrayEntries, &nsi);
        if (code == RXGEN_OPCODE) {
-           code = VLDB_ListAttributesU(&attributes, &nentries, &arrayEntries);
+           code = VLDB_ListAttributes(&attributes, &nentries, &arrayEntries);
            nsi = -1;
        }
        if (code) {
@@ -7011,8 +7194,8 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force)
        tentries += nentries;
 
        for (j = 0; j < nentries; j++) {
-           vlentry = &arrayEntries.ubulkentries_val[j];
-           MapHostToNetworkU(vlentry);
+           vlentry = &arrayEntries.nbulkentries_val[j];
+           MapHostToNetwork(vlentry);
 
            VPRINT1("Processing VLDB entry %d ...\n", j + 1);
 
@@ -7041,9 +7224,9 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force)
            }
        }
 
-       if (arrayEntries.ubulkentries_val) {
-           free(arrayEntries.ubulkentries_val);
-           arrayEntries.ubulkentries_val = 0;
+       if (arrayEntries.nbulkentries_val) {
+           free(arrayEntries.nbulkentries_val);
+           arrayEntries.nbulkentries_val = 0;
        }
     }
 
@@ -7058,8 +7241,8 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force)
   error_exit:
     if (aconn)
        rx_DestroyConnection(aconn);
-    if (arrayEntries.ubulkentries_val)
-       free(arrayEntries.ubulkentries_val);
+    if (arrayEntries.nbulkentries_val)
+       free(arrayEntries.nbulkentries_val);
 
     if (failures)
        error = VOLSERFAILEDOP;
@@ -7069,26 +7252,11 @@ UV_SyncServer(afs_uint32 aserver, afs_int32 apart, int flags, int force)
 /*rename volume <oldname> to <newname>, changing the names of the related
  *readonly and backup volumes. This operation is also idempotent.
  *salvager is capable of recovering from rename operation stopping halfway.
- *to recover run syncserver on the affected machines, it will force renaming
- *to completion. name clashes should have been detected before calling this proc */
-int
-UV_RenameVolume(struct nvldbentry *entryp, char oldname[], char newname[])
-{
-    struct uvldbentry uentry;
-    int error;
-
-    nvlentry_to_uvlentry(entryp, &uentry);
-    error = UV_RenameVolumeU(&uentry, oldname, newname);
-    if (!error)
-        error = uvlentry_to_nvlentry(&uentry, entryp);
-
-    return error;
-}
-
+ *to recover run syncserver on the affected machines,it will force renaming to completion. name clashes should have been detected before calling this proc */
 int
-UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[])
+UV_RenameVolume(struct nvldbentry *entry, char oldname[], char newname[])
 {
-    struct uvldbentry storeEntry;
+    struct nvldbentry storeEntry;
     afs_int32 vcode, code, rcode, error;
     int i, index;
     char nameBuffer[256];
@@ -7112,8 +7280,8 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[])
     }
     islocked = 1;
     strncpy(entry->name, newname, VOLSER_OLDMAXVOLNAME);
-    MapNetworkToHostU(entry, &storeEntry);
-    vcode = VLDB_ReplaceEntryU(entry->volumeId[RWVOL], RWVOL, &storeEntry, 0);
+    MapNetworkToHost(entry, &storeEntry);
+    vcode = VLDB_ReplaceEntry(entry->volumeId[RWVOL], RWVOL, &storeEntry, 0);
     if (vcode) {
        fprintf(STDERR, "Could not update VLDB entry for %u\n",
                entry->volumeId[RWVOL]);
@@ -7124,7 +7292,7 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[])
     /*at this stage the intent to rename is recorded in the vldb, as far as the vldb
      * is concerned, oldname is lost */
     if (entry->flags & RW_EXISTS) {
-       index = Lp_GetRwIndexU(entry);
+       index = Lp_GetRwIndex(entry);
        if (index == -1) {      /* there is a serious discrepancy */
            fprintf(STDERR,
                    "There is a serious discrepancy in VLDB entry for volume %u\n",
@@ -7133,7 +7301,7 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[])
            error = VOLSERVLDB_ERROR;
            goto rvfail;
        }
-       aconn = UV_Bind(entry->serverUnique[index], AFSCONF_VOLUMEPORT);
+       aconn = UV_Bind(entry->serverNumber[index], AFSCONF_VOLUMEPORT);
        code =
            AFSVolTransCreate_retry(aconn, entry->volumeId[RWVOL],
                              entry->serverPartition[index], ITOffline, &tid);
@@ -7174,7 +7342,7 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[])
     }
     /*end rw volume processing */
     if (entry->flags & BACK_EXISTS) {  /*process the backup volume */
-       index = Lp_GetRwIndexU(entry);
+       index = Lp_GetRwIndex(entry);
        if (index == -1) {      /* there is a serious discrepancy */
            fprintf(STDERR,
                    "There is a serious discrepancy in the VLDB entry for the backup volume %u\n",
@@ -7183,7 +7351,7 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[])
            error = VOLSERVLDB_ERROR;
            goto rvfail;
        }
-       aconn = UV_Bind(entry->serverUnique[index], AFSCONF_VOLUMEPORT);
+       aconn = UV_Bind(entry->serverNumber[index], AFSCONF_VOLUMEPORT);
        code =
            AFSVolTransCreate_retry(aconn, entry->volumeId[BACKVOL],
                              entry->serverPartition[index], ITOffline, &tid);
@@ -7233,7 +7401,7 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[])
     if (entry->flags & RO_EXISTS) {    /*process the ro volumes */
        for (i = 0; i < entry->nServers; i++) {
            if (entry->serverFlags[i] & ITSROVOL) {
-               aconn = UV_Bind(entry->serverUnique[i], AFSCONF_VOLUMEPORT);
+               aconn = UV_Bind(entry->serverNumber[i], AFSCONF_VOLUMEPORT);
                code =
                    AFSVolTransCreate_retry(aconn, entry->volumeId[ROVOL],
                                      entry->serverPartition[i], ITOffline,
@@ -7261,9 +7429,9 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[])
                        VPRINT2("Renamed RO volume %s on host %s\n",
                                nameBuffer,
                                 noresolve ?
-                                afs_inet_ntoa_r(entry->serverUnique[i], hoststr) :
+                                afs_inet_ntoa_r(entry->serverNumber[i], hoststr) :
                                 hostutil_GetNameByINet(entry->
-                                                      serverUnique[i]));
+                                                      serverNumber[i]));
                        code = AFSVolEndTrans(aconn, tid, &rcode);
                        tid = 0;
                        if (code) {
@@ -7315,6 +7483,7 @@ UV_RenameVolumeU(struct uvldbentry *entry, char oldname[], char newname[])
        rx_DestroyConnection(aconn);
     PrintError("", error);
     return error;
+
 }
 
 /*report on all the active transactions on volser */
@@ -7353,46 +7522,16 @@ UV_VolserStatus(afs_uint32 server, transDebugInfo ** rpntr, afs_int32 * rcount)
 int
 UV_VolumeZap(afs_uint32 server, afs_int32 part, afs_uint32 volid)
 {
-    afs_int32 rcode, ttid, error, code;
+    afs_int32 error;
     struct rx_connection *aconn;
 
-    code = 0;
-    error = 0;
-    ttid = 0;
-
     aconn = UV_Bind(server, AFSCONF_VOLUMEPORT);
-    code = AFSVolTransCreate_retry(aconn, volid, part, ITOffline, &ttid);
-    if (code) {
-       fprintf(STDERR, "Could not start transaction on volume %lu\n",
-               (unsigned long)volid);
-       error = code;
-       goto zfail;
-    }
-    code = AFSVolDeleteVolume(aconn, ttid);
-    if (code) {
-       fprintf(STDERR, "Could not delete volume %lu\n",
-               (unsigned long)volid);
-       error = code;
-       goto zfail;
-    }
-    code = AFSVolEndTrans(aconn, ttid, &rcode);
-    ttid = 0;
-    if (!code)
-       code = rcode;
-    if (code) {
-       fprintf(STDERR, "Could not end transaction on volume %lu\n",
-               (unsigned long)volid);
-       error = code;
-       goto zfail;
-    }
-  zfail:
-    if (ttid) {
-       code = AFSVolEndTrans(aconn, ttid, &rcode);
-       if (!code)
-           code = rcode;
-       if (!error)
-           error = code;
+    error = DoVolDelete(aconn, volid, part,
+                       "the", 0, NULL, NULL);
+    if (error == VNOVOL) {
+       EPRINT1(error, "Failed to start transaction on %u\n", volid);
     }
+
     PrintError("", error);
     if (aconn)
        rx_DestroyConnection(aconn);
@@ -7538,30 +7677,6 @@ UV_GetSize(afs_uint32 afromvol, afs_uint32 afromserver, afs_int32 afrompart,
 /*maps the host addresses in <old > (present in network byte order) to
  that in< new> (present in host byte order )*/
 void
-MapNetworkToHostU(struct uvldbentry *old, struct uvldbentry *new)
-{
-    int i, count;
-
-    /*copy all the fields */
-    strcpy(new->name, old->name);
-/*    new->volumeType = old->volumeType;*/
-    new->nServers = old->nServers;
-    count = old->nServers;
-    if (count < NMAXNSERVERS)
-       count++;
-    for (i = 0; i < count; i++) {
-       new->serverUnique[i] = ntohl(old->serverUnique[i]);
-       new->serverPartition[i] = old->serverPartition[i];
-       new->serverFlags[i] = old->serverFlags[i];
-    }
-    new->volumeId[RWVOL] = old->volumeId[RWVOL];
-    new->volumeId[ROVOL] = old->volumeId[ROVOL];
-    new->volumeId[BACKVOL] = old->volumeId[BACKVOL];
-    new->cloneId = old->cloneId;
-    new->flags = old->flags;
-}
-
-void
 MapNetworkToHost(struct nvldbentry *old, struct nvldbentry *new)
 {
     int i, count;
@@ -7587,19 +7702,6 @@ MapNetworkToHost(struct nvldbentry *old, struct nvldbentry *new)
 
 /*maps the host entries in <entry> which are present in host byte order to network byte order */
 void
-MapHostToNetworkU(struct uvldbentry *entry)
-{
-    int i, count;
-
-    count = entry->nServers;
-    if (count < NMAXNSERVERS)
-       count++;
-    for (i = 0; i < count; i++) {
-       entry->serverUnique[i] = htonl(entry->serverUnique[i]);
-    }
-}
-
-void
 MapHostToNetwork(struct nvldbentry *entry)
 {
     int i, count;
@@ -7611,4 +7713,3 @@ MapHostToNetwork(struct nvldbentry *entry)
        entry->serverNumber[i] = htonl(entry->serverNumber[i]);
     }
 }
-