[OpenAFS] "vos examine -extended" - statistics not reset @ midnight

Rainer Toebbicke rtb@pclella.cern.ch
Mon, 15 Oct 2007 10:26:50 +0200


This is a multi-part message in MIME format.
--------------040005060008020802060107
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

The "extended" statistics provided by "vos examine -extended" are not 
properly reset @ midnight.

That is, they are actually reset correctly, however "vos examine" does 
not get the copy from the fileserver, but from the volume header. The 
code there to deal with out-of-date statistics correctly sets the 
number of accesses to 0, but leaves the extended statistics at their 
old value. You can therefore end up with volumes of 0 accesses in the 
past day and millions of writes.

Patch attached, Bcc'ed to openafs-bugs.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rainer Toebbicke
European Laboratory for Particle Physics(CERN) - Geneva, Switzerland
Phone: +41 22 767 8985       Fax: +41 22 767 7155

--------------040005060008020802060107
Content-Type: text/plain;
 name="p_vos_ext_stats"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="p_vos_ext_stats"

--- openafs/src/volser/volprocs.c.o144	2006-12-19 04:40:14.000000000 +0100
+++ openafs/src/volser/volprocs.c	2007-10-02 10:16:48.000000000 +0200
@@ -2052,11 +2052,6 @@
 	    xInfoP->accessDate = volDiskDataP->accessDate;
 	    xInfoP->updateDate = volDiskDataP->updateDate;
 	    xInfoP->backupDate = volDiskDataP->backupDate;
-	    now = FT_ApproxTime();
-	    if (now - volDiskDataP->dayUseDate > OneDay)
-		xInfoP->dayUse = 0;
-	    else
-		xInfoP->dayUse = volDiskDataP->dayUse;
 	    xInfoP->filecount = volDiskDataP->filecount;
 	    xInfoP->maxquota = volDiskDataP->maxquota;
 	    xInfoP->size = volDiskDataP->diskused;
@@ -2064,8 +2059,15 @@
 	    /*
 	     * Copy out the stat fields in a single operation.
 	     */
-	    memcpy((char *)&(xInfoP->stat_reads[0]),
+	    now = FT_ApproxTime();
+	    if (now - volDiskDataP->dayUseDate > OneDay) {
+		xInfoP->dayUse = 0;
+		memset((char *)&(xInfoP->stat_reads[0]), 0, numStatBytes);
+	    } else {
+		xInfoP->dayUse = volDiskDataP->dayUse;
+		memcpy((char *)&(xInfoP->stat_reads[0]),
 		   (char *)&(volDiskDataP->stat_reads[0]), numStatBytes);
+	    }
 
 	    /*
 	     * We're done copying.  Detach the volume and iterate (at this

--------------040005060008020802060107--