windows-64bit-printf-sanity-20090218
[openafs.git] / src / viced / afsfileprocs.c
index 1ea8a89..f48c01b 100644 (file)
@@ -47,14 +47,7 @@ RCSID
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
-
-#ifdef HAVE_STRING_H
 #include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
 
 #ifndef AFS_LINUX20_ENV
 #include <net/if.h>
@@ -321,6 +314,11 @@ CallPreamble(register struct rx_call *acall, int activecall,
     H_LOCK;
   retry:
     tclient = h_FindClient_r(*tconn);
+    if (!tclient) {
+       ViceLog(0, ("CallPreamble: Couldn't get CPS. Too many lockers\n"));
+       H_UNLOCK;
+       return VBUSY;
+    }
     thost = tclient->host;
     if (tclient->prfail == 1) {        /* couldn't get the CPS */
        if (!retry_flag) {
@@ -344,7 +342,8 @@ CallPreamble(register struct rx_call *acall, int activecall,
            hpr_End(uclient);
        code = hpr_Initialize(&uclient);
 
-       assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+       if (!code)
+           assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
        H_LOCK;
 #else
        code = pr_Initialize(2, AFSDIR_SERVER_ETC_DIRPATH, 0);
@@ -424,6 +423,8 @@ CallPostamble(register struct rx_connection *aconn, afs_int32 ret,
 
     H_LOCK;
     tclient = h_FindClient_r(aconn);
+    if (!tclient) 
+       goto busyout;
     thost = tclient->host;
     if (thost->hostFlags & HERRORTRANS)
        translate = 1;
@@ -445,6 +446,7 @@ CallPostamble(register struct rx_connection *aconn, afs_int32 ret,
                afs_inet_ntoa_r(thost->host, hoststr), ntohs(thost->port),
                thost));
     }
+ busyout:
     H_UNLOCK;
     return (translate ? sys_error_to_et(ret) : ret);
 }                              /*CallPostamble */
@@ -467,6 +469,14 @@ CheckVnode(AFSFid * fid, Volume ** volptr, Vnode ** vptr, int lock)
        extern int VInit;
 
        while (1) {
+           int restarting = 
+#ifdef AFS_DEMAND_ATTACH_FS
+               VSALVAGE
+#else
+               VRESTARTING
+#endif
+               ;
+
            errorCode = 0;
            *volptr = VGetVolume(&local_errorCode, &errorCode, (afs_int32) fid->Volume);
            if (!errorCode) {
@@ -523,25 +533,25 @@ CheckVnode(AFSFid * fid, Volume ** volptr, Vnode ** vptr, int lock)
                if (restartedat.tv_sec == 0) {
                    /* I'm not really worried about when we restarted, I'm   */
                    /* just worried about when the first VBUSY was returned. */
-                   TM_GetTimeOfDay(&restartedat, 0);
+                   FT_GetTimeOfDay(&restartedat, 0);
                    if (busyonrst) {
                        FS_LOCK;
                        afs_perfstats.fs_nBusies++;
                        FS_UNLOCK;
                    }
-                   return (busyonrst ? VBUSY : VRESTARTING);
+                   return (busyonrst ? VBUSY : restarting);
                } else {
                    struct timeval now;
-                   TM_GetTimeOfDay(&now, 0);
+                   FT_GetTimeOfDay(&now, 0);
                    if ((now.tv_sec - restartedat.tv_sec) < (11 * 60)) {
                        if (busyonrst) {
                            FS_LOCK;
                            afs_perfstats.fs_nBusies++;
                            FS_UNLOCK;
                        }
-                       return (busyonrst ? VBUSY : VRESTARTING);
+                       return (busyonrst ? VBUSY : restarting);
                    } else {
-                       return (VRESTARTING);
+                       return (restarting);
                    }
                }
            }
@@ -549,6 +559,14 @@ CheckVnode(AFSFid * fid, Volume ** volptr, Vnode ** vptr, int lock)
             * must check local_errorCode because demand attach fs
             * can have local_errorCode == VSALVAGING, errorCode == VBUSY */
            else if (local_errorCode == VBUSY && lock == READ_LOCK) {
+#ifdef AFS_DEMAND_ATTACH_FS
+               /* DAFS case is complicated by the fact that local_errorCode can
+                * be VBUSY in cases where the volume is truly offline */
+               if (!*volptr) {
+                   /* volume is in VOL_STATE_UNATTACHED */
+                   return (errorCode);
+               }
+#endif /* AFS_DEMAND_ATTACH_FS */
                errorCode = 0;
                break;
            } else if (errorCode)
@@ -1098,7 +1116,13 @@ CopyOnWrite(Vnode * targetptr, Volume * volptr)
     }
 
     ino = VN_GET_INO(targetptr);
-    assert(VALID_INO(ino));
+    if (!VALID_INO(ino)) {
+       free(buff);
+       VTakeOffline(volptr);
+       ViceLog(0, ("Volume %u now offline, must be salvaged.\n",
+                   volptr->hashid));
+       return EIO;
+    }    
     targFdP = IH_OPEN(targetptr->handle);
     if (targFdP == NULL) {
        rc = errno;
@@ -1265,6 +1289,9 @@ DeleteTarget(Vnode * parentptr, Volume * volptr, Vnode ** targetptr,
       */
     if ((*targetptr)->disk.uniquifier != fileFid->Unique) {
        VTakeOffline(volptr);
+       ViceLog(0,
+               ("Volume %u now offline, must be salvaged.\n",
+                volptr->hashid));
        errorCode = VSALVAGE;
        return errorCode;
     }
@@ -1274,6 +1301,7 @@ DeleteTarget(Vnode * parentptr, Volume * volptr, Vnode ** targetptr,
        if (IsEmpty(&childdir) != 0)
            return (EEXIST);
        DZap(&childdir);
+       FidZap(&childdir);
        (*targetptr)->delete = 1;
     } else if ((--(*targetptr)->disk.linkCount) == 0)
        (*targetptr)->delete = 1;
@@ -1292,10 +1320,10 @@ DeleteTarget(Vnode * parentptr, Volume * volptr, Vnode ** targetptr,
                         errno));
                if (errno != ENOENT)
                {
+                   VTakeOffline(volptr);
                    ViceLog(0,
                            ("Volume %u now offline, must be salvaged.\n",
                             volptr->hashid));
-                   VTakeOffline(volptr);
                    return (EIO);
                }
                DT1++;
@@ -1318,10 +1346,10 @@ DeleteTarget(Vnode * parentptr, Volume * volptr, Vnode ** targetptr,
                ("Error %d deleting %s\n", code,
                 (((*targetptr)->disk.type ==
                   Directory) ? "directory" : "file")));
+       VTakeOffline(volptr);
        ViceLog(0,
                ("Volume %u now offline, must be salvaged.\n",
                 volptr->hashid));
-       VTakeOffline(volptr);
        if (!errorCode)
            errorCode = code;
     }
@@ -1629,7 +1657,7 @@ Alloc_NewVnode(Vnode * parentptr, DirHandle * dir, Volume * volptr,
         AdjustDiskUsage(volptr, BlocksPreallocatedForVnode,
                         BlocksPreallocatedForVnode))) {
        ViceLog(25,
-               ("Insufficient space to allocate %lld blocks\n",
+               ("Insufficient space to allocate %" AFS_INT64_FMT " blocks\n",
                 (afs_intmax_t) BlocksPreallocatedForVnode));
        return (errorCode);
     }
@@ -1725,8 +1753,10 @@ HandleLocking(Vnode * targetptr, struct client *client, afs_int32 rights, ViceLo
                0;
        Time += AFS_LOCKWAIT;
        if (LockingType == LockRead) {
-           if ( !(rights & PRSFS_LOCK) )
-               return(EACCES);
+           if ( !(rights & PRSFS_LOCK) && 
+                 !(rights & PRSFS_WRITE) &&
+                 !(OWNSp(client, targetptr) && (rights & PRSFS_INSERT)) )
+                    return(EACCES);
 
            if (targetptr->disk.lock.lockCount >= 0) {
                ++(targetptr->disk.lock.lockCount);
@@ -1835,8 +1865,8 @@ RXGetVolumeStatus(AFSFetchVolumeStatus * status, char **name, char **offMsg,
     status->MinQuota = V_minquota(volptr);
     status->MaxQuota = V_maxquota(volptr);
     status->BlocksInUse = V_diskused(volptr);
-    status->PartBlocksAvail = volptr->partition->free;
-    status->PartMaxBlocks = volptr->partition->totalUsable;
+    status->PartBlocksAvail = RoundInt64ToInt32(volptr->partition->free);
+    status->PartMaxBlocks = RoundInt64ToInt32(volptr->partition->totalUsable);
 
     /* now allocate and copy these things; they're freed by the RXGEN stub */
     temp = strlen(V_name(volptr)) + 1;
@@ -2048,7 +2078,7 @@ common_FetchData64(struct rx_call *acall, struct AFSFid *Fid,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     ViceLog(1,
@@ -2113,7 +2143,7 @@ common_FetchData64(struct rx_call *acall, struct AFSFid *Fid,
     /*
      * Remember when the data transfer started.
      */
-    TM_GetTimeOfDay(&xferStartTime, 0);
+    FT_GetTimeOfDay(&xferStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     /* actually do the data transfer */
@@ -2134,7 +2164,7 @@ common_FetchData64(struct rx_call *acall, struct AFSFid *Fid,
      * integrate the transfer size and elapsed time into the stats.  If the
      * operation failed, we jump to the appropriate point.
      */
-    TM_GetTimeOfDay(&xferStopTime, 0);
+    FT_GetTimeOfDay(&xferStopTime, 0);
     FS_LOCK;
     (xferP->numXfers)++;
     if (!errorCode) {
@@ -2216,7 +2246,7 @@ common_FetchData64(struct rx_call *acall, struct AFSFid *Fid,
     errorCode = CallPostamble(tcon, errorCode, thost);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (errorCode == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -2305,7 +2335,7 @@ SRXAFS_FetchACL(struct rx_call * acall, struct AFSFid * Fid,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     ViceLog(1,
@@ -2368,7 +2398,7 @@ SRXAFS_FetchACL(struct rx_call * acall, struct AFSFid * Fid,
     errorCode = CallPostamble(tcon, errorCode, thost);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (errorCode == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -2501,7 +2531,7 @@ SRXAFS_BulkStatus(struct rx_call * acall, struct AFSCBFids * Fids,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     ViceLog(1, ("SAFS_BulkStatus\n"));
@@ -2593,7 +2623,7 @@ SRXAFS_BulkStatus(struct rx_call * acall, struct AFSCBFids * Fids,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (errorCode == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -2651,7 +2681,7 @@ SRXAFS_InlineBulkStatus(struct rx_call * acall, struct AFSCBFids * Fids,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     ViceLog(1, ("SAFS_InlineBulkStatus\n"));
@@ -2761,7 +2791,7 @@ SRXAFS_InlineBulkStatus(struct rx_call * acall, struct AFSCBFids * Fids,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (errorCode == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -2810,7 +2840,7 @@ SRXAFS_FetchStatus(struct rx_call * acall, struct AFSFid * Fid,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
@@ -2824,7 +2854,7 @@ SRXAFS_FetchStatus(struct rx_call * acall, struct AFSFid * Fid,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -2889,7 +2919,7 @@ common_StoreData64(struct rx_call *acall, struct AFSFid *Fid,
     ViceLog(1,
            ("StoreData: Fid = %u.%u.%u\n", Fid->Volume, Fid->Vnode,
             Fid->Unique));
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     FS_LOCK;
@@ -2947,7 +2977,7 @@ common_StoreData64(struct rx_call *acall, struct AFSFid *Fid,
     /*
      * Remember when the data transfer started.
      */
-    TM_GetTimeOfDay(&xferStartTime, 0);
+    FT_GetTimeOfDay(&xferStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     /* Do the actual storing of the data */
@@ -2970,7 +3000,7 @@ common_StoreData64(struct rx_call *acall, struct AFSFid *Fid,
      * integrate the transfer size and elapsed time into the stats.  If the
      * operation failed, we jump to the appropriate point.
      */
-    TM_GetTimeOfDay(&xferStopTime, 0);
+    FT_GetTimeOfDay(&xferStopTime, 0);
     FS_LOCK;
     (xferP->numXfers)++;
     if (!errorCode) {
@@ -3047,7 +3077,7 @@ common_StoreData64(struct rx_call *acall, struct AFSFid *Fid,
     errorCode = CallPostamble(tcon, errorCode, thost);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (errorCode == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -3146,7 +3176,7 @@ SRXAFS_StoreACL(struct rx_call * acall, struct AFSFid * Fid,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
     if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
        goto Bad_StoreACL;
@@ -3209,7 +3239,7 @@ SRXAFS_StoreACL(struct rx_call * acall, struct AFSFid * Fid,
     errorCode = CallPostamble(tcon, errorCode, thost);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (errorCode == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -3341,7 +3371,7 @@ SRXAFS_StoreStatus(struct rx_call * acall, struct AFSFid * Fid,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
@@ -3355,7 +3385,7 @@ SRXAFS_StoreStatus(struct rx_call * acall, struct AFSFid * Fid,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -3504,7 +3534,7 @@ SRXAFS_RemoveFile(struct rx_call * acall, struct AFSFid * DirFid, char *Name,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
@@ -3518,7 +3548,7 @@ SRXAFS_RemoveFile(struct rx_call * acall, struct AFSFid * DirFid, char *Name,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -3671,7 +3701,7 @@ SRXAFS_CreateFile(struct rx_call * acall, struct AFSFid * DirFid, char *Name,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     memset(OutFid, 0, sizeof(struct AFSFid));
@@ -3689,7 +3719,7 @@ SRXAFS_CreateFile(struct rx_call * acall, struct AFSFid * DirFid, char *Name,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -3978,6 +4008,9 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName,
            VPutVnode(&errorCode, testvptr);
            if ((top == 1) && (testnode != 0)) {
                VTakeOffline(volptr);
+               ViceLog(0,
+                       ("Volume %u now offline, must be salvaged.\n",
+                        volptr->hashid));
                errorCode = EIO;
                goto Bad_Rename;
            }
@@ -4161,7 +4194,7 @@ SRXAFS_Rename(struct rx_call * acall, struct AFSFid * OldDirFid,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
@@ -4177,7 +4210,7 @@ SRXAFS_Rename(struct rx_call * acall, struct AFSFid * OldDirFid,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -4307,10 +4340,18 @@ SAFSS_Symlink(struct rx_call *acall, struct AFSFid *DirFid, char *Name,
 
     /* Write the contents of the symbolic link name into the target inode */
     fdP = IH_OPEN(targetptr->handle);
-    assert(fdP != NULL);
+    if (fdP == NULL) {
+       (void)PutVolumePackage(parentwhentargetnotdir, targetptr, parentptr,
+                              volptr, &client);
+       VTakeOffline(volptr);
+       ViceLog(0, ("Volume %u now offline, must be salvaged.\n",
+                   volptr->hashid));
+       return EIO;
+    }    
     len = strlen((char *) LinkContents);
-     code = (len == FDH_WRITE(fdP, (char *) LinkContents, len)) ? 0 : VDISKFULL;
-     if (code) ViceLog(0, ("SAFSS_Symlink FDH_WRITE failed for len=%d, Fid=%u.%d.%d\n", len, OutFid->Volume, OutFid->Vnode, OutFid->Unique));
+    code = (len == FDH_WRITE(fdP, (char *) LinkContents, len)) ? 0 : VDISKFULL;
+    if (code) 
+       ViceLog(0, ("SAFSS_Symlink FDH_WRITE failed for len=%d, Fid=%u.%d.%d\n", len, OutFid->Volume, OutFid->Vnode, OutFid->Unique));
     FDH_CLOSE(fdP);
     /*
      * Set up and return modified status for the parent dir and new symlink
@@ -4368,7 +4409,7 @@ SRXAFS_Symlink(acall, DirFid, Name, LinkContents, InStatus, OutFid,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
@@ -4384,7 +4425,7 @@ SRXAFS_Symlink(acall, DirFid, Name, LinkContents, InStatus, OutFid,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -4569,7 +4610,7 @@ SRXAFS_Link(struct rx_call * acall, struct AFSFid * DirFid, char *Name,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
@@ -4585,7 +4626,7 @@ SRXAFS_Link(struct rx_call * acall, struct AFSFid * DirFid, char *Name,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -4770,7 +4811,7 @@ SRXAFS_MakeDir(struct rx_call * acall, struct AFSFid * DirFid, char *Name,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
        goto Bad_MakeDir;
@@ -4785,7 +4826,7 @@ SRXAFS_MakeDir(struct rx_call * acall, struct AFSFid * DirFid, char *Name,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -4933,7 +4974,7 @@ SRXAFS_RemoveDir(struct rx_call * acall, struct AFSFid * DirFid, char *Name,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
@@ -4947,7 +4988,7 @@ SRXAFS_RemoveDir(struct rx_call * acall, struct AFSFid * DirFid, char *Name,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -5065,7 +5106,7 @@ SRXAFS_SetLock(struct rx_call * acall, struct AFSFid * Fid, ViceLockType type,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
@@ -5079,7 +5120,7 @@ SRXAFS_SetLock(struct rx_call * acall, struct AFSFid * Fid, ViceLockType type,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -5191,7 +5232,7 @@ SRXAFS_ExtendLock(struct rx_call * acall, struct AFSFid * Fid,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
@@ -5205,7 +5246,7 @@ SRXAFS_ExtendLock(struct rx_call * acall, struct AFSFid * Fid,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -5327,7 +5368,7 @@ SRXAFS_ReleaseLock(struct rx_call * acall, struct AFSFid * Fid,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
@@ -5341,7 +5382,7 @@ SRXAFS_ReleaseLock(struct rx_call * acall, struct AFSFid * Fid,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -5374,7 +5415,7 @@ SetSystemStats(struct AFSStatistics *stats)
     struct timeval time;
 
     /* this works on all system types */
-    TM_GetTimeOfDay(&time, 0);
+    FT_GetTimeOfDay(&time, 0);
     stats->CurrentTime = time.tv_sec;
 }                              /*SetSystemStats */
 
@@ -5425,13 +5466,13 @@ SetAFSStats(struct AFSStatistics *stats)
 void
 SetVolumeStats(struct AFSStatistics *stats)
 {
-    struct DiskPartition *part;
+    struct DiskPartition64 *part;
     int i = 0;
 
     for (part = DiskPartitionList; part && i < AFS_MSTATDISKS;
         part = part->next) {
-       stats->Disks[i].TotalBlocks = part->totalUsable;
-       stats->Disks[i].BlocksAvailable = part->free;
+       stats->Disks[i].TotalBlocks = RoundInt64ToInt32(part->totalUsable);
+       stats->Disks[i].BlocksAvailable = RoundInt64ToInt32(part->free);
        memset(stats->Disks[i].Name, 0, AFS_DISKNAMESIZE);
        strncpy(stats->Disks[i].Name, part->name, AFS_DISKNAMESIZE);
        i++;
@@ -5462,7 +5503,7 @@ SRXAFS_GetStatistics(struct rx_call *acall, struct ViceStatistics *Statistics)
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, NOTACTIVECALL, &tcon, &thost)))
@@ -5483,7 +5524,118 @@ SRXAFS_GetStatistics(struct rx_call *acall, struct ViceStatistics *Statistics)
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
+    if (code == 0) {
+       FS_LOCK;
+       (opP->numSuccesses)++;
+       fs_stats_GetDiff(elapsedTime, opStartTime, opStopTime);
+       fs_stats_AddTo((opP->sumTime), elapsedTime);
+       fs_stats_SquareAddTo((opP->sqrTime), elapsedTime);
+       if (fs_stats_TimeLessThan(elapsedTime, (opP->minTime))) {
+           fs_stats_TimeAssign((opP->minTime), elapsedTime);
+       }
+       if (fs_stats_TimeGreaterThan(elapsedTime, (opP->maxTime))) {
+           fs_stats_TimeAssign((opP->maxTime), elapsedTime);
+       }
+       FS_UNLOCK;
+    }
+#endif /* FS_STATS_DETAILED */
+
+    osi_auditU(acall, GetStatisticsEvent, code, 
+               AUD_ID, t_client ? t_client->ViceId : 0, AUD_END);
+    return code;
+}                              /*SRXAFS_GetStatistics */
+
+
+afs_int32
+SRXAFS_GetStatistics64(struct rx_call *acall, afs_int32 statsVersion, ViceStatistics64 *Statistics)
+{
+    extern afs_int32 StartTime, CurrentConnections;
+    int seconds;
+    afs_int32 code;
+    struct rx_connection *tcon = rx_ConnectionOf(acall);
+    struct host *thost;
+    struct client *t_client = NULL;    /* tmp ptr to client data */
+    struct timeval time;
+#if FS_STATS_DETAILED
+    struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
+    struct timeval opStartTime, opStopTime;    /* Start/stop times for RPC op */
+    struct timeval elapsedTime;        /* Transfer time */
+
+    /*
+     * Set our stats pointer, remember when the RPC operation started, and
+     * tally the operation.
+     */
+    opP = &(afs_FullPerfStats.det.rpcOpTimes[FS_STATS_RPCIDX_GETSTATISTICS]);
+    FS_LOCK;
+    (opP->numOps)++;
+    FS_UNLOCK;
+    FT_GetTimeOfDay(&opStartTime, 0);
+#endif /* FS_STATS_DETAILED */
+
+    if ((code = CallPreamble(acall, NOTACTIVECALL, &tcon, &thost)))
+       goto Bad_GetStatistics64;
+
+    ViceLog(1, ("SAFS_GetStatistics64 Received\n"));
+    Statistics->ViceStatistics64_val = 
+       malloc(statsVersion*sizeof(afs_int64));
+    Statistics->ViceStatistics64_len = statsVersion;
+    FS_LOCK;
+    AFSCallStats.GetStatistics++, AFSCallStats.TotalCalls++;
+    Statistics->ViceStatistics64_val[STATS64_STARTTIME] = StartTime;
+    Statistics->ViceStatistics64_val[STATS64_CURRENTCONNECTIONS] =
+       CurrentConnections;
+    Statistics->ViceStatistics64_val[STATS64_TOTALVICECALLS] = 
+       AFSCallStats.TotalCalls;
+    Statistics->ViceStatistics64_val[STATS64_TOTALFETCHES] =
+       AFSCallStats.FetchData + AFSCallStats.FetchACL +
+       AFSCallStats.FetchStatus;
+    Statistics->ViceStatistics64_val[STATS64_FETCHDATAS] = 
+       AFSCallStats.FetchData;
+    Statistics->ViceStatistics64_val[STATS64_FETCHEDBYTES] = 
+       AFSCallStats.TotalFetchedBytes;
+    seconds = AFSCallStats.AccumFetchTime / 1000;
+    if (seconds <= 0)
+        seconds = 1;
+    Statistics->ViceStatistics64_val[STATS64_FETCHDATARATE] = 
+       AFSCallStats.TotalFetchedBytes / seconds;
+    Statistics->ViceStatistics64_val[STATS64_TOTALSTORES] =
+        AFSCallStats.StoreData + AFSCallStats.StoreACL +
+        AFSCallStats.StoreStatus;
+    Statistics->ViceStatistics64_val[STATS64_STOREDATAS] = 
+       AFSCallStats.StoreData;
+    Statistics->ViceStatistics64_val[STATS64_STOREDBYTES] = 
+       AFSCallStats.TotalStoredBytes;
+    seconds = AFSCallStats.AccumStoreTime / 1000;
+    if (seconds <= 0)
+        seconds = 1;
+    Statistics->ViceStatistics64_val[STATS64_STOREDATARATE] = 
+       AFSCallStats.TotalStoredBytes / seconds;
+#ifdef AFS_NT40_ENV
+    Statistics->ViceStatistics64_val[STATS64_PROCESSSIZE] = -1;
+#else
+    Statistics->ViceStatistics64_val[STATS64_PROCESSSIZE] = 
+       (afs_int32) ((long)sbrk(0) >> 10);
+#endif
+    FS_UNLOCK;
+    h_GetWorkStats((int *)&(Statistics->ViceStatistics64_val[STATS64_WORKSTATIONS]),
+                   (int *)&(Statistics->ViceStatistics64_val[STATS64_ACTIVEWORKSTATIONS]), 
+                  (int *)0,
+                   (afs_int32) (FT_ApproxTime()) - (15 * 60));
+
+
+
+    /* this works on all system types */
+    FT_GetTimeOfDay(&time, 0);
+    Statistics->ViceStatistics64_val[STATS64_CURRENTTIME] = time.tv_sec;
+
+  Bad_GetStatistics64:
+    code = CallPostamble(tcon, code, thost);
+
+    t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
+
+#if FS_STATS_DETAILED
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -5545,7 +5697,7 @@ SRXAFS_XStatsVersion(struct rx_call * a_call, afs_int32 * a_versionP)
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     *a_versionP = AFS_XSTAT_VERSION;
@@ -5553,7 +5705,7 @@ SRXAFS_XStatsVersion(struct rx_call * a_call, afs_int32 * a_versionP)
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     fs_stats_GetDiff(elapsedTime, opStartTime, opStopTime);
     fs_stats_AddTo((opP->sumTime), elapsedTime);
     fs_stats_SquareAddTo((opP->sqrTime), elapsedTime);
@@ -5749,7 +5901,7 @@ SRXAFS_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     /*
@@ -5892,7 +6044,7 @@ SRXAFS_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum,
     }                          /*Switch on collection number */
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -5937,7 +6089,7 @@ common_GiveUpCallBacks(struct rx_call *acall, struct AFSCBFids *FidArray,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if (FidArray)
@@ -5957,7 +6109,9 @@ common_GiveUpCallBacks(struct rx_call *acall, struct AFSCBFids *FidArray,
                 (tcon->peer ? tcon->peer->host : 0)));
        errorCode = GetClient(tcon, &client);
        if (!errorCode) {
+           H_LOCK;
            DeleteAllCallBacks_r(client->host, 1);
+           H_UNLOCK;
            PutClient(&client);
        }
     } else {
@@ -5984,7 +6138,7 @@ common_GiveUpCallBacks(struct rx_call *acall, struct AFSCBFids *FidArray,
     errorCode = CallPostamble(tcon, errorCode, thost);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (errorCode == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -6282,7 +6436,7 @@ SRXAFS_GetVolumeInfo(struct rx_call * acall, char *avolid,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
        goto Bad_GetVolumeInfo;
@@ -6301,7 +6455,7 @@ SRXAFS_GetVolumeInfo(struct rx_call * acall, char *avolid,
     code = CallPostamble(tcon, code, thost);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -6352,7 +6506,7 @@ SRXAFS_GetVolumeStatus(struct rx_call * acall, afs_int32 avolid,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     ViceLog(1, ("SAFS_GetVolumeStatus for volume %u\n", avolid));
@@ -6403,7 +6557,7 @@ SRXAFS_GetVolumeStatus(struct rx_call * acall, afs_int32 avolid,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (errorCode == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -6457,7 +6611,7 @@ SRXAFS_SetVolumeStatus(struct rx_call * acall, afs_int32 avolid,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     ViceLog(1, ("SAFS_SetVolumeStatus for volume %u\n", avolid));
@@ -6501,7 +6655,7 @@ SRXAFS_SetVolumeStatus(struct rx_call * acall, afs_int32 avolid,
     t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (errorCode == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -6553,7 +6707,7 @@ SRXAFS_GetRootVolume(struct rx_call * acall, char **VolumeName)
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     return FSERR_EOPNOTSUPP;
@@ -6591,7 +6745,7 @@ SRXAFS_GetRootVolume(struct rx_call * acall, char **VolumeName)
     errorCode = CallPostamble(tcon, errorCode, thost);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (errorCode == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -6635,7 +6789,7 @@ SRXAFS_CheckToken(struct rx_call * acall, afs_int32 AfsId,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
@@ -6647,7 +6801,7 @@ SRXAFS_CheckToken(struct rx_call * acall, afs_int32 AfsId,
     code = CallPostamble(tcon, code, thost);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     if (code == 0) {
        FS_LOCK;
        (opP->numSuccesses)++;
@@ -6689,7 +6843,7 @@ SRXAFS_GetTime(struct rx_call * acall, afs_uint32 * Seconds,
     FS_LOCK;
     (opP->numOps)++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&opStartTime, 0);
+    FT_GetTimeOfDay(&opStartTime, 0);
 #endif /* FS_STATS_DETAILED */
 
     if ((code = CallPreamble(acall, NOTACTIVECALL, &tcon, &thost)))
@@ -6698,7 +6852,7 @@ SRXAFS_GetTime(struct rx_call * acall, afs_uint32 * Seconds,
     FS_LOCK;
     AFSCallStats.GetTime++, AFSCallStats.TotalCalls++;
     FS_UNLOCK;
-    TM_GetTimeOfDay(&tpl, 0);
+    FT_GetTimeOfDay(&tpl, 0);
     *Seconds = tpl.tv_sec;
     *USeconds = tpl.tv_usec;
 
@@ -6708,7 +6862,7 @@ SRXAFS_GetTime(struct rx_call * acall, afs_uint32 * Seconds,
     code = CallPostamble(tcon, code, thost);
 
 #if FS_STATS_DETAILED
-    TM_GetTimeOfDay(&opStopTime, 0);
+    FT_GetTimeOfDay(&opStopTime, 0);
     fs_stats_GetDiff(elapsedTime, opStartTime, opStopTime);
     if (code == 0) {
        FS_LOCK;
@@ -6797,11 +6951,13 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr,
        rx_Write(Call, (char *)&zero, sizeof(afs_int32));       /* send 0-length  */
        return (0);
     }
-    TM_GetTimeOfDay(&StartTime, 0);
+    FT_GetTimeOfDay(&StartTime, 0);
     ihP = targetptr->handle;
     fdP = IH_OPEN(ihP);
     if (fdP == NULL) {
        VTakeOffline(volptr);
+       ViceLog(0, ("Volume %u now offline, must be salvaged.\n",
+                   volptr->hashid));
        return EIO;
     }
     optSize = sendBufSize;
@@ -6811,6 +6967,8 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr,
     if (tlen < 0) {
        FDH_CLOSE(fdP);
        VTakeOffline(volptr);
+       ViceLog(0, ("Volume %u now offline, must be salvaged.\n",
+                   volptr->hashid));
        return EIO;
     }
     if (Pos > tlen) {
@@ -6849,6 +7007,8 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr,
            FDH_CLOSE(fdP);
            FreeSendBuffer((struct afs_buffer *)tbuffer);
            VTakeOffline(volptr);
+           ViceLog(0, ("Volume %u now offline, must be salvaged.\n",
+                       volptr->hashid));
            return EIO;
        }
        errorCode = rx_Write(Call, tbuffer, wlen);
@@ -6863,6 +7023,8 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr,
        if (errorCode != wlen) {
            FDH_CLOSE(fdP);
            VTakeOffline(volptr);
+           ViceLog(0, ("Volume %u now offline, must be salvaged.\n",
+                       volptr->hashid));
            return EIO;
        }
        errorCode = rx_Writev(Call, tiov, tnio, wlen);
@@ -6887,7 +7049,7 @@ FetchData_RXStyle(Volume * volptr, Vnode * targetptr,
     FreeSendBuffer((struct afs_buffer *)tbuffer);
 #endif /* AFS_NT40_ENV */
     FDH_CLOSE(fdP);
-    TM_GetTimeOfDay(&StopTime, 0);
+    FT_GetTimeOfDay(&StopTime, 0);
 
     /* Adjust all Fetch Data related stats */
     FS_LOCK;
@@ -6989,11 +7151,11 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid,
     afs_sfsize_t tlen;         /* temp for xfr length */
     Inode tinode;              /* inode for I/O */
     afs_int32 optSize;         /* optimal transfer size */
-    afs_sfsize_t DataLength;   /* size of inode */
+    afs_sfsize_t DataLength = 0;       /* size of inode */
     afs_sfsize_t TruncatedLength;      /* size after ftruncate */
     afs_fsize_t NewLength;     /* size after this store completes */
     afs_sfsize_t adjustSize;   /* bytes to call VAdjust... with */
-    int linkCount;             /* link count on inode */
+    int linkCount = 0;         /* link count on inode */
     FdHandle_t *fdP;
     struct in_addr logHostAddr;        /* host ip holder for inet_ntoa */
 
@@ -7035,6 +7197,8 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid,
        if (GetLinkCountAndSize(volptr, fdP, &linkCount, &DataLength) < 0) {
            FDH_CLOSE(fdP);
            VTakeOffline(volptr);
+           ViceLog(0, ("Volume %u now offline, must be salvaged.\n",
+                       volptr->hashid));
            return EIO;
        }
 
@@ -7078,7 +7242,12 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid,
        }
        tinode = VN_GET_INO(targetptr);
     }
-    assert(VALID_INO(tinode));
+    if (!VALID_INO(tinode)) {
+       VTakeOffline(volptr);
+       ViceLog(0,("Volume %u now offline, must be salvaged.\n",
+                  volptr->hashid));
+       return EIO;
+    }
 
     /* compute new file length */
     NewLength = DataLength;
@@ -7106,7 +7275,7 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid,
     /* this bit means that the locks are set and protections are OK */
     rx_SetLocalStatus(Call, 1);
 
-    TM_GetTimeOfDay(&StartTime, 0);
+    FT_GetTimeOfDay(&StartTime, 0);
 
     optSize = sendBufSize;
     ViceLog(25,
@@ -7203,7 +7372,7 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid,
     }
     FDH_CLOSE(fdP);
 
-    TM_GetTimeOfDay(&StopTime, 0);
+    FT_GetTimeOfDay(&StopTime, 0);
 
     VN_SET_LEN(targetptr, NewLength);
 
@@ -7402,17 +7571,19 @@ SRXAFS_CallBackRxConnAddr (struct rx_call * acall, afs_int32 *addr)
 #else
     H_LOCK;
     tclient = h_FindClient_r(tcon);
+    if (!tclient) {
+       errorCode = VBUSY;
+       goto Bad_CallBackRxConnAddr;
+    }
     thost = tclient->host;
     
     /* nothing more can be done */
     if ( !thost->interface ) 
        goto Bad_CallBackRxConnAddr;
     
-    assert(thost->interface->numberOfInterfaces > 0 );
-    
     /* the only address is the primary interface */
     /* can't change when there's only 1 address, anyway */
-    if ( thost->interface->numberOfInterfaces == 1 ) 
+    if ( thost->interface->numberOfInterfaces <= 1 ) 
        goto Bad_CallBackRxConnAddr;
     
     /* initialise a security object only once */