diff --git a/src/afsmonitor/afsmon-output.c b/src/afsmonitor/afsmon-output.c index 1dc0e5907d..f9d9b5612e 100644 --- a/src/afsmonitor/afsmon-output.c +++ b/src/afsmonitor/afsmon-output.c @@ -368,14 +368,6 @@ Print_fs_FullPerfInfo(struct xstat_fs_ProbeResults *a_fs_Results) char *printableTime; /*Ptr to printable time string */ time_t probeTime; - numLongs = a_fs_Results->data.AFS_CollData_len; - if (numLongs != fullPerfLongs) { - fprintf(fs_outFD, - " ** Data size mismatch in full performance collection!\n"); - fprintf(fs_outFD, " ** Expecting %d, got %d\n", fullPerfLongs, - numLongs); - return; - } probeTime = a_fs_Results->probeTime; printableTime = ctime(&probeTime); @@ -388,8 +380,24 @@ Print_fs_FullPerfInfo(struct xstat_fs_ProbeResults *a_fs_Results) a_fs_Results->collectionNumber, a_fs_Results->connP->hostName, a_fs_Results->probeNum, printableTime); - Print_fs_OverallPerfInfo(&(fullPerfP->overall)); - Print_fs_DetailedPerfInfo(&(fullPerfP->det)); + numLongs = a_fs_Results->data.AFS_CollData_len; + if (numLongs != fullPerfLongs) { + fprintf(fs_outFD, + " ** Data size mismatch in full performance collection!\n"); + fprintf(fs_outFD, " ** Expecting %d, got %d\n", fullPerfLongs, + numLongs); + + /* Unfortunately, the full perf stats contain timeval structures which + * do not have the same size everywhere. At least try to print + * the overall stats. + */ + if (numLongs >= (sizeof(struct afs_stats_CMPerf) / sizeof(afs_int32))) { + Print_fs_OverallPerfInfo(&(fullPerfP->overall)); + } + } else { + Print_fs_OverallPerfInfo(&(fullPerfP->overall)); + Print_fs_DetailedPerfInfo(&(fullPerfP->det)); + } } /*Print_fs_FullPerfInfo */ diff --git a/src/afsmonitor/afsmonitor.c b/src/afsmonitor/afsmonitor.c index 08e3b4e77f..be0351a215 100644 --- a/src/afsmonitor/afsmonitor.c +++ b/src/afsmonitor/afsmonitor.c @@ -1808,6 +1808,7 @@ fs_Results_ltoa(struct fs_Display_Data *a_fsData, /* target buffer */ int idx; int i, j; afs_int32 *tmpbuf; + afs_int32 numInt32s; if (afsmon_debug) { fprintf(debugFD, "[ %s ] Called, a_fsData= %p, a_fsResults= %p\n", rn, @@ -1823,6 +1824,25 @@ fs_Results_ltoa(struct fs_Display_Data *a_fsData, /* target buffer */ * - fullPerfP->det which gives detailed info about file server operation * execution times */ + /* + * Unfortunately, the full perf stats contain timeval structures which + * do not have the same size everywhere. Avoid displaying gargbage, + * but at least try to show the overall stats. + */ + numInt32s = a_fsResults->data.AFS_CollData_len; + if (numInt32s != + (sizeof(struct fs_stats_FullPerfStats) / sizeof(afs_int32))) { + srcbuf = a_fsResults->data.AFS_CollData_val; + for (i = 0; i < NUM_FS_STAT_ENTRIES; i++) { + if (i < numInt32s && i < NUM_XSTAT_FS_AFS_PERFSTATS_LONGS) { + sprintf(a_fsData->data[i], "%d", srcbuf[i]); + } else { + sprintf(a_fsData->data[i], "%s", "--"); + } + } + return 0; + } + /* copy overall performance statistics */ srcbuf = (afs_int32 *) & (fullPerfP->overall); idx = 0;