AFS_STATCNT(afs_create);
- OutFidStatus = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
- OutDirStatus = osi_AllocSmallSpace(AFS_SMALLOCSIZ);
+ OutFidStatus = osi_AllocSmallSpace(sizeof(struct AFSFetchStatus));
+ OutDirStatus = osi_AllocSmallSpace(sizeof(struct AFSFetchStatus));
+ memset(&InStatus, 0, sizeof(InStatus));
if ((code = afs_CreateReq(&treq, acred)))
goto done2;
}
}
*avcp = tvc;
- } else
- code = ENOENT; /* shouldn't get here */
+
+ } else {
+ /* Directory entry already exists, but we cannot fetch the
+ * fid it points to. */
+ code = EIO;
+ }
/* make sure vrefCount bumped only if code == 0 */
goto done;
}
if (code) {
if (code < 0) {
- ObtainWriteLock(&afs_xcbhash, 488);
- afs_DequeueCallback(adp);
- adp->f.states &= ~CStatd;
- ReleaseWriteLock(&afs_xcbhash);
- osi_dnlc_purgedp(adp);
+ afs_StaleVCache(adp);
}
ReleaseWriteLock(&adp->lock);
if (tdc) {
afs_QueueCallback(tvc, CBHash(CallBack.ExpirationTime), volp);
}
} else {
- afs_DequeueCallback(tvc);
- tvc->f.states &= ~(CStatd | CUnique);
- tvc->callback = 0;
- if (tvc->f.fid.Fid.Vnode & 1 || (vType(tvc) == VDIR))
- osi_dnlc_purgedp(tvc);
+ afs_StaleVCacheFlags(tvc,
+ AFS_STALEVC_CBLOCKED | AFS_STALEVC_CLEARCB,
+ CUnique);
}
ReleaseWriteLock(&afs_xcbhash);
if (AFS_IS_DISCON_RW) {
ReleaseWriteLock(&tvc->lock);
*avcp = tvc;
code = 0;
- } else
- code = ENOENT;
+
+ } else {
+ /* Cannot create a new vcache. */
+ code = EIO;
+ }
} else {
/* otherwise cache entry already exists, someone else must
* have created it. Comments used to say: "don't need write
/* The bulk status code used the length as a sequence number. */
/* Don't update the vcache entry unless the stats are current. */
if (avc->f.states & CStatd) {
- hset(avc->f.m.DataVersion, avers);
+ afs_SetDataVersion(avc, &avers);
#ifdef AFS_64BIT_CLIENT
FillInt64(avc->f.m.Length, astat->Length_hi, astat->Length);
#else /* AFS_64BIT_CLIENT */