afs: Create afs_SetDataVersion
[openafs.git] / src / afs / VNOPS / afs_vnop_create.c
index a2d600d..30eaa7b 100644 (file)
@@ -356,11 +356,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
 
        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) {
@@ -451,11 +447,9 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
                    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) {
@@ -560,7 +554,7 @@ afs_LocalHero(struct vcache *avc, struct dcache *adc,
     /* 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 */