Patch #: 169 Type: bug fix & operational change Priority: medium Affects: sites running AUFS with STAT_CACHE code Modification: drop extraneous free() call Modification: get current time from scheduler rather than call time() Submitted: Rudy Nedved Reported: Tim Leamy Archived: munnari.OZ.AU mac/cap.patches/cap60.patch169 Application: 'cd cap60; patch -p < cap60.patches/cap60.patch169' File: cap60/applications/aufs/afpspd.c *** applications/aufs/afpspd.c.orig Mon Nov 8 16:19:26 1993 --- applications/aufs/afpspd.c Tue Nov 23 22:39:23 1993 *************** *** 34,39 **** --- 34,40 ---- private struct statobj STATS[MAX_LEVEL+1]; private time_t CUR_TIME; + private struct timeval *Sched_Now = NULL; /* pointer to scheduler clock */ #define EXP_TIME 120; *************** *** 55,63 **** STATS[P].RS = VAL_INVALID; } ! STATS[0].NAME = ""; ! ! time(&CUR_TIME); } OScd(path) --- 56,63 ---- STATS[P].RS = VAL_INVALID; } ! getschedulerclock(&Sched_Now); ! time(&CUR_TIME); /* since scheduler has not run yet */ } OScd(path) *************** *** 93,100 **** char * path; int flags,mode; { ! if (CUR_DIR != NULL && strncmp(path,CUR_DIR,CUR_DIR_LEN) == 0) return(open(path+CUR_DIR_LEN,flags,mode)); return(open(path,flags,mode)); } --- 93,105 ---- char * path; int flags,mode; { ! if (CUR_DIR != NULL && strncmp(path,CUR_DIR,CUR_DIR_LEN) == 0) { ! if (DBOSI) ! printf("OScwd_open=%s\n",path+CUR_DIR_LEN); return(open(path+CUR_DIR_LEN,flags,mode)); + } + if (DBOSI) + printf("OScwd_open=%s\n",path); return(open(path,flags,mode)); } *************** *** 101,114 **** char * cwd_path(path) char * path; { - if (DBOSI) - printf("OScwd_path=%s\n",path+CUR_DIR_LEN); if (CUR_DIR != NULL && strncmp(path,CUR_DIR,CUR_DIR_LEN) == 0) { if (DBOSI) printf("OScwd_path=%s\n",path+CUR_DIR_LEN); return path+CUR_DIR_LEN; ! } else ! return path; } private release_stats(K) --- 106,119 ---- char * cwd_path(path) char * path; { if (CUR_DIR != NULL && strncmp(path,CUR_DIR,CUR_DIR_LEN) == 0) { if (DBOSI) printf("OScwd_path=%s\n",path+CUR_DIR_LEN); return path+CUR_DIR_LEN; ! } ! if (DBOSI) ! printf("OScwd_path=%s\n",path); ! return path; } private release_stats(K) *************** *** 117,131 **** register int P; if (DBOSI) ! printf("release_stats=%d\n",K); for (P = K; P <= CUR_STAT_LEVEL; P++) { - free(STATS[P].NAME); STATS[P].STAT.st_nlink = -1; STATS[P].FN = VAL_INVALID; STATS[P].RS = VAL_INVALID; STATS[P].NAME = NULL; } } private int EXPIRE_REQ; --- 122,137 ---- register int P; if (DBOSI) ! printf("release_stats=%d of %d\n",K,CUR_STAT_LEVEL); for (P = K; P <= CUR_STAT_LEVEL; P++) { STATS[P].STAT.st_nlink = -1; STATS[P].FN = VAL_INVALID; STATS[P].RS = VAL_INVALID; STATS[P].NAME = NULL; } + if (K < CUR_STAT_LEVEL) + CUR_STAT_LEVEL = K; } private int EXPIRE_REQ; *************** *** 142,157 **** continue; if (STATS[K].VAL_TIME <= CUR_TIME) { if (DBOSI) ! printf("time delta %d vs %d (%d)\n", ! CUR_TIME, STATS[K].VAL_TIME, ! CUR_TIME - STATS[K].VAL_TIME); STATS[K].STAT.st_nlink = -1; STATS[K].FN = VAL_INVALID; STATS[K].RS = VAL_INVALID; ! if (DBOSI) ! printf("expired=%d(%s)\n t=%d", ! K, STATS[K].NAME, ! STATS[K].VAL_TIME - CUR_TIME); } } } --- 148,160 ---- continue; if (STATS[K].VAL_TIME <= CUR_TIME) { if (DBOSI) ! printf("expired=%d(%s) t=%d\n", ! K, STATS[K].NAME, ! STATS[K].VAL_TIME - CUR_TIME); STATS[K].STAT.st_nlink = -1; STATS[K].FN = VAL_INVALID; STATS[K].RS = VAL_INVALID; ! STATS[K].NAME = NULL; } } } *************** *** 189,194 **** --- 192,198 ---- if (*NEW == '\0') { if (DBOSI) printf("locate_statobj: root\n"); + STATS[0].NAME = ""; return(&STATS[0]); } /* something more */ *************** *** 298,304 **** char * path; struct stat *buf; { - struct stat B; struct statobj * CE; if (DBOSI) --- 302,307 ---- *************** *** 319,324 **** --- 322,329 ---- CE->VAL_TIME = CUR_TIME+EXP_TIME; return 0; } + if (DBOSI) + printf("OSstat=no cache\n"); return -1; } if (DBOSI) *************** *** 343,349 **** CE->FN = VAL_NO; else CE->FN = VAL_OK; - CE->VAL_TIME = CUR_TIME+EXP_TIME; return CE->FN; } strcpy(pp,path); --- 348,353 ---- *************** *** 371,377 **** CE->RS = VAL_NO; else CE->RS = VAL_OK; - CE->VAL_TIME = CUR_TIME+EXP_TIME; return CE->RS; } strcpy(pp,path); --- 375,380 ---- *************** *** 384,390 **** OSflush_stat() { ! time(&CUR_TIME); if (DBOSI) printf("OSflush_stat\n"); release_stats(0); --- 387,393 ---- OSflush_stat() { ! CUR_TIME = Sched_Now->tv_sec; if (DBOSI) printf("OSflush_stat\n"); release_stats(0); *************** *** 392,398 **** OSstat_cache_update() { ! time(&CUR_TIME); EXPIRE_REQ = 1; } --- 395,401 ---- OSstat_cache_update() { ! CUR_TIME = Sched_Now->tv_sec; EXPIRE_REQ = 1; } *** lib/cap/abversion.c.orig Tue Nov 23 20:39:20 1993 --- lib/cap/abversion.c Tue Nov 23 22:43:03 1993 *************** *** 1,7 **** /* ! * $Author: djh $ $Date: 1993/11/23 09:39:14 $ ! * $Header: /mac/src/cap60/lib/cap/RCS/abversion.c,v 2.68 1993/11/23 09:39:14 djh Rel djh $ ! * $Revision: 2.68 $ * */ --- 1,7 ---- /* ! * $Author: djh $ $Date: 1993/11/23 11:42:56 $ ! * $Header: /mac/src/cap60/lib/cap/RCS/abversion.c,v 2.69 1993/11/23 11:42:56 djh Rel djh $ ! * $Revision: 2.69 $ * */ *************** *** 32,38 **** myversion.cv_name = "CAP"; myversion.cv_version = 6; myversion.cv_subversion = 0; ! myversion.cv_patchlevel = 168; myversion.cv_rmonth = "November"; myversion.cv_ryear = "1993"; switch (lap_proto) { --- 32,38 ---- myversion.cv_name = "CAP"; myversion.cv_version = 6; myversion.cv_subversion = 0; ! myversion.cv_patchlevel = 169; myversion.cv_rmonth = "November"; myversion.cv_ryear = "1993"; switch (lap_proto) { *** README.orig Tue Nov 23 20:50:48 1993 --- README Tue Nov 23 22:43:57 1993 *************** *** 2,8 **** CAP - Columbia AppleTalk Package for UNIX o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 168, November 1993 Notice ------ --- 2,8 ---- CAP - Columbia AppleTalk Package for UNIX o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 169, November 1993 Notice ------