viced: Improve CallPreamble error messages
[openafs.git] / src / viced / afsfileprocs.c
index 9190133..62652b3 100644 (file)
@@ -343,7 +343,10 @@ CallPreamble(struct rx_call *acall, int activecall,
   retry:
     tclient = h_FindClient_r(*tconn);
     if (!tclient) {
-       ViceLog(0, ("CallPreamble: Couldn't get client.\n"));
+       ViceLog(0, ("CallPreamble: Couldn't get client struct for host "
+                   "%s:%d, sending busy signal\n",
+                   afs_inet_ntoa_r(rx_HostOf(rx_PeerOf(*tconn)), hoststr),
+                   (int)ntohs(rx_PortOf(rx_PeerOf(*tconn)))));
        H_UNLOCK;
        return VBUSY;
     }
@@ -352,7 +355,10 @@ CallPreamble(struct rx_call *acall, int activecall,
        if (!retry_flag) {
            h_ReleaseClient_r(tclient);
            h_Release_r(thost);
-           ViceLog(0, ("CallPreamble: Couldn't get CPS. Fail\n"));
+           ViceLog(0, ("CallPreamble: Couldn't get CPS for client from host "
+                       "%s:%d, failing request\n",
+                       afs_inet_ntoa_r(thost->host, hoststr),
+                       (int)ntohs(thost->port)));
            H_UNLOCK;
            return -1001;
        }
@@ -380,7 +386,10 @@ CallPreamble(struct rx_call *acall, int activecall,
            h_ReleaseClient_r(tclient);
            h_Release_r(thost);
            H_UNLOCK;
-           ViceLog(0, ("CallPreamble: couldn't reconnect to ptserver\n"));
+           ViceLog(0, ("CallPreamble: couldn't reconnect to ptserver while "
+                       "handling request for %s:%d\n",
+                       afs_inet_ntoa_r(thost->host, hoststr),
+                       (int)ntohs(thost->port)));
            return -1001;
        }
 
@@ -1394,7 +1403,7 @@ CopyOnWrite(Vnode * targetptr, Volume * volptr, afs_foff_t off, afs_fsize_t len)
                FDH_REALLYCLOSE(newFdP);
                IH_RELEASE(newH);
                FDH_REALLYCLOSE(targFdP);
-               rc = IH_DEC(V_linkHandle(volptr), ino, V_parentId(volptr));
+               IH_DEC(V_linkHandle(volptr), ino, V_parentId(volptr));
                free(buff);
                VTakeOffline(volptr);
                return EIO;
@@ -1701,9 +1710,11 @@ Update_TargetVnodeStatus(Vnode * targetptr, afs_uint32 Caller,
     if (Caller & TVS_SDATA) {
        targetptr->disk.dataVersion++;
        if (!remote && VanillaUser(client)) {
-           targetptr->disk.modeBits &= ~04000; /* turn off suid for file. */
+           /* turn off suid */
+           targetptr->disk.modeBits = targetptr->disk.modeBits & ~04000;
 #ifdef CREATE_SGUID_ADMIN_ONLY
-           targetptr->disk.modeBits &= ~02000; /* turn off sgid for file. */
+           /* turn off sgid */
+           targetptr->disk.modeBits = targetptr->disk.modeBits & ~02000;
 #endif
        }
     }
@@ -1719,9 +1730,11 @@ Update_TargetVnodeStatus(Vnode * targetptr, afs_uint32 Caller,
     if (InStatus->Mask & AFS_SETOWNER) {
        /* admin is allowed to do chmod, chown as well as chown, chmod. */
        if (!remote && VanillaUser(client)) {
-           targetptr->disk.modeBits &= ~04000; /* turn off suid for file. */
+           /* turn off suid */
+           targetptr->disk.modeBits = targetptr->disk.modeBits & ~04000;
 #ifdef CREATE_SGUID_ADMIN_ONLY
-           targetptr->disk.modeBits &= ~02000; /* turn off sgid for file. */
+           /* turn off sgid */
+           targetptr->disk.modeBits = targetptr->disk.modeBits & ~02000;
 #endif
        }
        targetptr->disk.owner = InStatus->Owner;
@@ -5094,7 +5107,7 @@ SRXAFS_GetStatistics64(struct rx_call *acall, afs_int32 statsVersion, ViceStatis
 
     ViceLog(1, ("SAFS_GetStatistics64 Received\n"));
     Statistics->ViceStatistics64_val =
-       malloc(statsVersion*sizeof(afs_int64));
+       malloc(statsVersion*sizeof(afs_uint64));
     Statistics->ViceStatistics64_len = statsVersion;
     FS_LOCK;
     AFSCallStats.GetStatistics++, AFSCallStats.TotalCalls++;
@@ -5644,7 +5657,7 @@ SRXAFS_GetCapabilities(struct rx_call * acall, Capabilities * capabilities)
     code = CallPostamble(tcon, code, thost);
 
 
-    return 0;
+    return code;
 }
 
 /* client is held, but not locked */
@@ -6536,6 +6549,7 @@ StoreData_RXStyle(Volume * volptr, Vnode * targetptr, struct AFSFid * Fid,
        /* Set the file's length; we've already done an lseek to the right
         * spot above.
         */
+       tlen = 0; /* Just a source of data for the write */
        nBytes = FDH_PWRITE(fdP, &tlen, 1, Pos);
        if (nBytes != 1) {
            errorCode = -1;