]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
afs: Log a message on invalid FetchStatus receipt
authorAndrew Deason <adeason@sinenomine.net>
Fri, 2 Mar 2012 23:18:25 +0000 (17:18 -0600)
committerDerrick Brashear <shadow@dementix.org>
Thu, 30 Aug 2012 12:02:06 +0000 (05:02 -0700)
If we get an invalid AFSFetchStatus structure from a server, log a
message to indicate as such. This serves as a warning to urge people
to fix their fileservers, and to explain what is doing.

Reviewed-on: http://gerrit.openafs.org/6881
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
(cherry picked from commit 577d5d99fefb62f0b52a568207d2352946b36137)

Change-Id: I10dc2dd94d2cd7277e48dfff1accb36e7cab8537
Reviewed-on: http://gerrit.openafs.org/7993
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/afs/VNOPS/afs_vnop_lookup.c
src/afs/afs_prototypes.h
src/afs/afs_vcache.c

index b52d21dd59046cb1d341a51dddaffee6cf90dacf..f4f28dac0c6c51c3c6888d4bdf17a3355d153e15 100644 (file)
@@ -630,6 +630,10 @@ afs_CheckBulkStatus(struct afs_conn *tc, int nFids, AFSBulkStats *statParm,
     int code;
 
     if (statParm->AFSBulkStats_len != nFids || cbParm->AFSCBs_len != nFids) {
+       afs_warn("afs: BulkFetchStatus length %u/%u, expected %u\n",
+                (unsigned)statParm->AFSBulkStats_len,
+                (unsigned)cbParm->AFSCBs_len, nFids);
+       afs_BadFetchStatus(tc);
        return VBUSY;
     }
     for (i = 0; i < nFids; i++) {
index 8afda0285d94fcc6c500af3e69533c9410046480..f411ddd5116c408a3bc58c7c61c988e311fb3a04 100644 (file)
@@ -1041,6 +1041,7 @@ extern void afs_FlushReclaimedVcaches(void);
 void afs_vcacheInit(int astatSize);
 extern struct vcache *afs_FindVCache(struct VenusFid *afid, afs_int32 * retry,
                                     afs_int32 flag);
+extern void afs_BadFetchStatus(struct afs_conn *tc);
 extern int afs_CheckFetchStatus(struct afs_conn *tc,
                                 struct AFSFetchStatus *status);
 extern afs_int32 afs_FetchStatus(struct vcache *avc, struct VenusFid *afid,
index 399eaee1b9305fe57b65edac5601430ea0fa51bd..8b7115c9ea1c98eea40015ffa75e44844e8dc1e9 100644 (file)
@@ -2280,6 +2280,19 @@ afs_UpdateStatus(struct vcache *avc, struct VenusFid *afid,
        afs_PutVolume(volp, READ_LOCK);
 }
 
+void
+afs_BadFetchStatus(struct afs_conn *tc)
+{
+    int addr = ntohl(tc->srvr->sa_ip);
+    afs_warn("afs: Invalid AFSFetchStatus from server %u.%u.%u.%u\n",
+             (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff,
+             (addr) & 0xff);
+    afs_warn("afs: This suggests the server may be sending bad data that "
+             "can lead to availability issues or data corruption. The "
+             "issue has been avoided for now, but it may not always be "
+             "detectable. Please upgrade the server if possible.\n");
+}
+
 /**
  * Check if a given AFSFetchStatus structure is sane.
  *
@@ -2299,6 +2312,12 @@ afs_CheckFetchStatus(struct afs_conn *tc, struct AFSFetchStatus *status)
         !(status->FileType > Invalid && status->FileType <= SymbolicLink) ||
         status->ParentVnode == 0 || status->ParentUnique == 0) {
 
+       afs_warn("afs: FetchStatus ec %u iv %u ft %u pv %u pu %u\n",
+                (unsigned)status->errorCode, (unsigned)status->InterfaceVersion,
+                (unsigned)status->FileType, (unsigned)status->ParentVnode,
+                (unsigned)status->ParentUnique);
+       afs_BadFetchStatus(tc);
+
        return VBUSY;
     }
     return 0;