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
This commit is contained in:
Jeffrey Altman 2007-02-08 13:49:58 +00:00
parent 0cc59928b9
commit 403b5086dd
2 changed files with 8 additions and 5 deletions

View File

@ -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",

View File

@ -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;