From 403b5086dddf16ef360b3dade0f3fa0e12db5b71 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 8 Feb 2007 13:49:58 +0000 Subject: [PATCH] windows-scp-recycle-init-20070208 when we recycle a stat cache object be sure to clear the file type so we don't inherit the previous file type if the fetch status fails. in merge status, clear the file type if the errorCode is EACCESS --- src/WINNT/afsd/cm_access.c | 8 ++++---- src/WINNT/afsd/cm_scache.c | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/WINNT/afsd/cm_access.c b/src/WINNT/afsd/cm_access.c index d9d141a9af..4b1f71926e 100644 --- a/src/WINNT/afsd/cm_access.c +++ b/src/WINNT/afsd/cm_access.c @@ -40,8 +40,8 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32 long trights; if (scp->flags & CM_SCACHEFLAG_EACCESS) { - *outRightsp = aclScp->anyAccess; - return CM_ERROR_NOACCESS; + *outRightsp = 0; + return 1; } didLock = 0; @@ -64,7 +64,7 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32 return 0; } - /* check that we have a callback, too */ + /* check that we have a callback, too */ if (!cm_HaveCallback(aclScp)) { /* can't use it */ lock_ReleaseMutex(&aclScp->mx); @@ -99,7 +99,7 @@ int cm_HaveAccessRights(struct cm_scache *scp, struct cm_user *userp, afs_uint32 *outRightsp = trights; } - if (scp->fileType != CM_SCACHETYPE_DIRECTORY) { + if (scp->fileType > 0 && scp->fileType != CM_SCACHETYPE_DIRECTORY) { /* check mode bits */ if ((scp->unixModeBits & 0400) == 0) { osi_Log2(afsd_logp,"cm_HaveAccessRights UnixMode removing READ scp 0x%p unix 0x%x", diff --git a/src/WINNT/afsd/cm_scache.c b/src/WINNT/afsd/cm_scache.c index 9431712be2..b8a30e9a01 100644 --- a/src/WINNT/afsd/cm_scache.c +++ b/src/WINNT/afsd/cm_scache.c @@ -147,6 +147,7 @@ long cm_RecycleSCache(cm_scache_t *scp, afs_int32 flags) /* invalidate so next merge works fine; * also initialize some flags */ + scp->fileType = 0; scp->flags &= ~(CM_SCACHEFLAG_STATD | CM_SCACHEFLAG_DELETED | CM_SCACHEFLAG_RO @@ -577,7 +578,7 @@ long cm_GetSCache(cm_fid_t *fidp, cm_scache_t **outScpp, cm_user_t *userp, return 0; } } - + // yj: when we get here, it means we don't have an scp // so we need to either load it or fake it, depending // on whether the file is "special", see below. @@ -1316,6 +1317,8 @@ void cm_MergeStatus(cm_scache_t *dscp, scp->flags |= CM_SCACHEFLAG_EACCESS; osi_Log2(afsd_logp, "Merge, Failure scp %x code 0x%x", scp, statusp->errorCode); + scp->fileType = 0; /* unknown */ + scp->serverModTime = 0; scp->clientModTime = 0; scp->length.LowPart = 0;