]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Treat vc_error as a CheckCode-translated code
authorAndrew Deason <adeason@sinenomine.net>
Thu, 26 Dec 2013 21:42:46 +0000 (16:42 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Thu, 27 Feb 2014 13:26:54 +0000 (05:26 -0800)
The vcache field vc_error is generally treated as an error code that
has been translated through afs_CheckCode, but this is inconsistent in
a few places. Fix this in a few ways:

 - Adjust afs_nfsrdwr so we do not call afs_CheckCode on vc_error,
   translating the error code twice.

 - Change afs_close to store vc_error in code_checkcode, and have the
   logging code check for specific values in code_checkcode as well.
   Log unknown values of code and code_checkcode, so we can
   distinguish between e.g. a 'code' value of VBUSY, and a
   'code_checkcode' value of ETIMEDOUT.

Reviewed-on: http://gerrit.openafs.org/10634
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: Derrick Brashear <shadow@your-file-system.com>
(cherry picked from commit 34e4a4fed356fbda9fc8ace1d01a080bd09238b0)

Change-Id: Icceee0c82b0704e0d445f96946b493b4be424506
Reviewed-on: http://gerrit.openafs.org/10813
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/SOLARIS/osi_vnodeops.c
src/afs/VNOPS/afs_vnop_write.c

index ff1e124bc6433f824350886d9a3ca0c828575df4..478d19625625e505dbe6d7ab7020520868f67fea 100644 (file)
@@ -676,6 +676,7 @@ afs_nfsrdwr(struct vcache *avc, struct uio *auio, enum uio_rw arw,
 {
     afs_int32 code;
     afs_int32 code2;
+    afs_int32 code_checkcode = 0;
     int counter;
     afs_int32 mode, sflags;
     char *data;
@@ -1008,7 +1009,7 @@ afs_nfsrdwr(struct vcache *avc, struct uio *auio, enum uio_rw arw,
     }
 
     if (!code && avc->vc_error) {
-       code = avc->vc_error;
+       code = code_checkcode = avc->vc_error;
     }
     ReleaseWriteLock(&avc->lock);
     afs_BozonUnlock(&avc->pvnLock, avc);
@@ -1031,7 +1032,11 @@ afs_nfsrdwr(struct vcache *avc, struct uio *auio, enum uio_rw arw,
     if (code == 0 && extraResid > 0)
        auio->uio_resid += extraResid;
 #endif
-    return afs_CheckCode(code, &treq, 46);
+    if (code_checkcode) {
+       return code_checkcode;
+    } else {
+       return afs_CheckCode(code, &treq, 46);
+    }
 }
 
 int
index 50e0702966328b87bd4d1ac2bb49d4ba8bcfb88d..70429816ad6fd886094117f3280d46b62563b5ce 100644 (file)
@@ -787,9 +787,13 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, afs_ucred_t *acred)
 #ifdef AFS_AIX32_ENV
            osi_ReleaseVM(avc, acred);
 #endif
-           /* printf("avc->vc_error=%d\n", avc->vc_error); */
-           code = avc->vc_error;
-           code_checkcode = 0;
+           /* We don't know what the original raw error code was, so set
+            * 'code' to 0. But we have the afs_CheckCode-translated error
+            * code, so put that in code_checkcode. We cannot just set code
+            * to avc->vc_error, since vc_error is a checkcode-translated
+            * error code, and 'code' is supposed to be a raw error code. */
+           code = 0;
+           code_checkcode = avc->vc_error;
            avc->vc_error = 0;
        }
        ReleaseWriteLock(&avc->lock);
@@ -799,19 +803,19 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, afs_ucred_t *acred)
            afs_warnuser("afs: failed to store file (network problems)\n");
        }
 #ifdef AFS_SUN5_ENV
-       else if (code == ENOSPC) {
+       else if (code == ENOSPC || code_checkcode == ENOSPC) {
            afs_warnuser
                ("afs: failed to store file (over quota or partition full)\n");
        }
 #else
-       else if (code == ENOSPC) {
+       else if (code == ENOSPC || code_checkcode == ENOSPC) {
            afs_warnuser("afs: failed to store file (partition full)\n");
-       } else if (code == EDQUOT) {
+       } else if (code == EDQUOT || code_checkcode == EDQUOT) {
            afs_warnuser("afs: failed to store file (over quota)\n");
        }
 #endif
-       else if (code != 0)
-           afs_warnuser("afs: failed to store file (%d)\n", code);
+       else if (code || code_checkcode)
+           afs_warnuser("afs: failed to store file (%d/%d)\n", code, code_checkcode);
 
        /* finally, we flush any text pages lying around here */
        hzero(avc->flushDV);
@@ -827,7 +831,8 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, afs_ucred_t *acred)
 #ifdef AFS_AIX32_ENV
            osi_ReleaseVM(avc, acred);
 #endif
-           code = avc->vc_error;
+           code = 0;
+           code_checkcode = avc->vc_error;
            avc->vc_error = 0;
        }
 #if defined(AFS_FBSD80_ENV)