viced: SRXAFS_InlineBulkStatus set InterfaceVersion on error
[openafs.git] / src / viced / afsfileprocs.c
index 914024e..6c7cad1 100644 (file)
@@ -173,7 +173,6 @@ struct afs_FSStats {
 
 struct afs_FSStats afs_fsstats;
 
-int LogLevel = 0;
 int supported = 1;
 int Console = 0;
 afs_int32 BlocksSpare = 1024;  /* allow 1 MB overruns */
@@ -851,8 +850,6 @@ GetVolumePackageWithCall(struct rx_call *acall, struct VCallByVol *cbv,
     Error errorCode = 0;               /* return code to caller */
     struct rx_connection *tcon = rx_ConnectionOf(acall);
 
-    rx_KeepAliveOff(acall);
-
     if ((errorCode = CheckVnodeWithCall(Fid, volptr, cbv, targetptr, locktype)))
        goto gvpdone;
 
@@ -904,8 +901,6 @@ GetVolumePackageWithCall(struct rx_call *acall, struct VCallByVol *cbv,
 #endif /* ADMIN_IMPLICIT_LOOKUP */
     }
 gvpdone:
-    if (errorCode)
-       rx_KeepAliveOn(acall);
     return errorCode;
 
 }                              /*GetVolumePackage */
@@ -957,7 +952,6 @@ PutVolumePackageWithCall(struct rx_call *acall, Vnode *
 {
     Error fileCode = 0;                /* Error code returned by the volume package */
 
-    rx_KeepAliveOff(acall);
     if (parentwhentargetnotdir) {
        VPutVnode(&fileCode, parentwhentargetnotdir);
        assert_vnode_success_or_salvaging(fileCode);
@@ -973,7 +967,6 @@ PutVolumePackageWithCall(struct rx_call *acall, Vnode *
     if (volptr) {
        VPutVolumeWithCall(volptr, cbv);
     }
-    rx_KeepAliveOn(acall);
 
     if (*client) {
        PutClient(client);
@@ -2360,8 +2353,6 @@ common_FetchData64(struct rx_call *acall, struct AFSFid *Fid,
     GetStatus(targetptr, OutStatus, rights, anyrights,
              &tparentwhentargetnotdir);
 
-    rx_KeepAliveOn(acall); /* I/O done */
-
     /* if a r/w volume, promise a callback to the caller */
     if (VolumeWriteable(volptr))
        SetCallBackStruct(AddCallBack(client->z.host, Fid), CallBack);
@@ -2540,8 +2531,6 @@ SAFSS_FetchStatus(struct rx_call *acall, struct AFSFid *Fid,
                          &rights, &anyrights)))
        goto Bad_FetchStatus;
 
-    rx_KeepAliveOn(acall);
-
     /* set volume synchronization information */
     SetVolumeSync(Sync, volptr);
 
@@ -2639,8 +2628,6 @@ SRXAFS_BulkStatus(struct rx_call * acall, struct AFSCBFids * Fids,
                              &rights, &anyrights)))
            goto Bad_BulkStatus;
 
-       rx_KeepAliveOn(acall);
-
        /* set volume synchronization information, but only once per call */
        if (i == 0)
            SetVolumeSync(Sync, volptr);
@@ -2766,6 +2753,7 @@ SRXAFS_InlineBulkStatus(struct rx_call * acall, struct AFSCBFids * Fids,
                              &rights, &anyrights))) {
            tstatus = &OutStats->AFSBulkStats_val[i];
 
+           tstatus->InterfaceVersion = 1;
            if (thost->z.hostFlags & HERRORTRANS) {
                tstatus->errorCode = sys_error_to_et(errorCode);
            } else {
@@ -2781,8 +2769,6 @@ SRXAFS_InlineBulkStatus(struct rx_call * acall, struct AFSCBFids * Fids,
            continue;
        }
 
-       rx_KeepAliveOn(acall);
-
        /* set volume synchronization information, but only once per call */
        if (!VolSync_set) {
            SetVolumeSync(Sync, volptr);
@@ -2796,6 +2782,7 @@ SRXAFS_InlineBulkStatus(struct rx_call * acall, struct AFSCBFids * Fids,
                                        CHK_FETCHSTATUS, 0))) {
                tstatus = &OutStats->AFSBulkStats_val[i];
 
+               tstatus->InterfaceVersion = 1;
                if (thost->z.hostFlags & HERRORTRANS) {
                    tstatus->errorCode = sys_error_to_et(errorCode);
                } else {
@@ -2947,8 +2934,6 @@ common_StoreData64(struct rx_call *acall, struct AFSFid *Fid,
        goto Bad_StoreData;
     }
 
-    rx_KeepAliveOn(acall);
-
     /* set volume synchronization information */
     SetVolumeSync(Sync, volptr);
 
@@ -2971,9 +2956,7 @@ common_StoreData64(struct rx_call *acall, struct AFSFid *Fid,
      */
     if (parentwhentargetnotdir != NULL) {
        tparentwhentargetnotdir = *parentwhentargetnotdir;
-       rx_KeepAliveOff(acall);
        VPutVnode(&fileCode, parentwhentargetnotdir);
-       rx_KeepAliveOn(acall);
        assert_vnode_success_or_salvaging(fileCode);
        parentwhentargetnotdir = NULL;
     }
@@ -2991,11 +2974,9 @@ common_StoreData64(struct rx_call *acall, struct AFSFid *Fid,
     if (errorCode && (!targetptr->changed_newTime))
        goto Bad_StoreData;
 
-    rx_KeepAliveOff(acall);
     /* Update the status of the target's vnode */
     Update_TargetVnodeStatus(targetptr, TVS_SDATA, client, InStatus,
                             targetptr, volptr, 0, 0);
-    rx_KeepAliveOn(acall);
 
     /* Get the updated File's status back to the caller */
     GetStatus(targetptr, OutStatus, rights, anyrights,
@@ -3120,8 +3101,6 @@ SRXAFS_StoreACL(struct rx_call * acall, struct AFSFid * Fid,
     VVnodeWriteToRead(&errorCode, targetptr);
     assert_vnode_success_or_salvaging(errorCode);
 
-    rx_KeepAliveOn(acall);
-
     /* break call backs on the directory  */
     BreakCallBack(client->z.host, Fid, 0);
 
@@ -3208,8 +3187,6 @@ SAFSS_StoreStatus(struct rx_call *acall, struct AFSFid *Fid,
                             (parentwhentargetnotdir ? parentwhentargetnotdir
                              : targetptr), volptr, 0, 0);
 
-    rx_KeepAliveOn(acall);
-
     /* convert the write lock to a read lock before breaking callbacks */
     VVnodeWriteToRead(&errorCode, targetptr);
     assert_vnode_success_or_salvaging(errorCode);
@@ -3327,8 +3304,6 @@ SAFSS_RemoveFile(struct rx_call *acall, struct AFSFid *DirFid, char *Name,
                             parentptr->disk.linkCount,
                             client->z.InSameNetwork);
 
-    rx_KeepAliveOn(acall);
-
     /* Return the updated parent dir's status back to caller */
     GetStatus(parentptr, OutDirStatus, rights, anyrights, 0);
 
@@ -3471,8 +3446,6 @@ SAFSS_CreateFile(struct rx_call *acall, struct AFSFid *DirFid, char *Name,
     Update_TargetVnodeStatus(targetptr, TVS_CFILE, client, InStatus,
                             parentptr, volptr, 0, 0);
 
-    rx_KeepAliveOn(acall);
-
     /* set up the return status for the parent dir and the newly created file, and since the newly created file is owned by the creator, give it PRSFS_ADMINISTER to tell the client its the owner of the file */
     GetStatus(targetptr, OutFidStatus, rights | PRSFS_ADMINISTER, anyrights, parentptr);
     GetStatus(parentptr, OutDirStatus, rights, anyrights, 0);
@@ -3877,7 +3850,7 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName,
                             NewName, errno));
                    if ((errno != ENOENT) && (errno != EIO)
                        && (errno != ENXIO))
-                       ViceLog(0, ("Do we need to fsck?"));
+                       ViceLog(0, ("Do we need to fsck?\n"));
                }
            }
            VN_SET_INO(newfileptr, (Inode) 0);
@@ -3960,8 +3933,6 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName,
        assert_vnode_success_or_salvaging(errorCode);
     }
 
-    rx_KeepAliveOn(acall);
-
     /* break call back on NewDirFid, OldDirFid, NewDirFid and newFileFid  */
     BreakCallBack(client->z.host, NewDirFid, 0);
     if (oldvptr != newvptr) {
@@ -3988,7 +3959,6 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName,
 
   Bad_Rename:
     if (newfileptr) {
-       rx_KeepAliveOff(acall);
        VPutVnode(&fileCode, newfileptr);
        assert_vnode_success_or_salvaging(fileCode);
     }
@@ -4164,8 +4134,6 @@ SAFSS_Symlink(struct rx_call *acall, struct AFSFid *DirFid, char *Name,
     VVnodeWriteToRead(&errorCode, parentptr);
     assert_vnode_success_or_salvaging(errorCode);
 
-    rx_KeepAliveOn(acall);
-
     /* break call back on the parent dir */
     BreakCallBack(client->z.host, DirFid, 0);
 
@@ -4342,8 +4310,6 @@ SAFSS_Link(struct rx_call *acall, struct AFSFid *DirFid, char *Name,
     VVnodeWriteToRead(&errorCode, parentptr);
     assert_vnode_success_or_salvaging(errorCode);
 
-    rx_KeepAliveOn(acall);
-
     /* break call back on DirFid */
     BreakCallBack(client->z.host, DirFid, 0);
     /*
@@ -4511,8 +4477,6 @@ SAFSS_MakeDir(struct rx_call *acall, struct AFSFid *DirFid, char *Name,
     VVnodeWriteToRead(&errorCode, parentptr);
     assert_vnode_success_or_salvaging(errorCode);
 
-    rx_KeepAliveOn(acall);
-
     /* break call back on DirFid */
     BreakCallBack(client->z.host, DirFid, 0);
 
@@ -4647,8 +4611,6 @@ SAFSS_RemoveDir(struct rx_call *acall, struct AFSFid *DirFid, char *Name,
     VVnodeWriteToRead(&errorCode, parentptr);
     assert_vnode_success_or_salvaging(errorCode);
 
-    rx_KeepAliveOn(acall);
-
     /* break call back on DirFid and fileFid */
     BreakCallBack(client->z.host, DirFid, 0);
 
@@ -4946,7 +4908,6 @@ SAFSS_ReleaseLock(struct rx_call *acall, struct AFSFid *Fid,
 
     /* if no more locks left, a callback would be triggered here */
     if (targetptr->disk.lock.lockCount <= 0) {
-       rx_KeepAliveOn(acall);
        /* convert the write lock to a read lock before breaking callbacks */
        VVnodeWriteToRead(&errorCode, targetptr);
        assert_vnode_success_or_salvaging(errorCode);
@@ -5392,6 +5353,8 @@ SRXAFS_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum,
                 afs_int32 * a_timeP, AFS_CollData * a_dataP)
 {                              /*SRXAFS_GetXStats */
 
+    struct client *t_client = NULL;    /* tmp ptr to client data */
+    struct rx_connection *tcon = rx_ConnectionOf(a_call);
     int code;          /*Return value */
     afs_int32 *dataBuffP;      /*Ptr to data to be returned */
     afs_int32 dataBytes;       /*Bytes in data buffer */
@@ -5399,6 +5362,7 @@ SRXAFS_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum,
 
     fsstats_StartOp(&fsstats, FS_STATS_RPCIDX_GETXSTATS);
 
+    t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
     /*
      * Record the time of day and the server version number.
      */
@@ -5410,9 +5374,10 @@ SRXAFS_GetXStats(struct rx_call *a_call, afs_int32 a_clientVersionNum,
      */
     code = 0;
 
-    ViceLog(1,
-           ("Received GetXStats call for collection %d\n",
-            a_collectionNumber));
+    osi_auditU(a_call, GetXStatsEvent,
+              AUD_ID, t_client ? t_client->z.ViceId : 0,
+              AUD_INT, a_clientVersionNum,
+              AUD_INT, a_collectionNumber, AUD_END);
 
 #if 0
     /*
@@ -6450,7 +6415,6 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid,
                 inet_ntoa(logHostAddr), ntohs(rxr_PortOf(rx_ConnectionOf(Call)))));
        return ENOENT;          /* is this proper error code? */
     } else {
-       rx_KeepAliveOff(Call);
        /*
         * See if the file has several links (from other volumes).  If it
         * does, then we have to make a copy before changing it to avoid