From: Simon Wilkinson Date: Sun, 25 Jan 2009 14:48:39 +0000 (+0000) Subject: DEVEL15-disconnected-clear-cstatd-on-reconnect-20090125 X-Git-Tag: openafs-devel-1_5_58~181 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=50ad15d5a483f150d3e6ec67928bb02bfe38dcf1;p=packages%2Fo%2Fopenafs.git DEVEL15-disconnected-clear-cstatd-on-reconnect-20090125 LICENSE IPL10 FIXES 124180 don't treat any information we forged as being valid while offline as valid (cherry picked from commit 58ab0e7c58e1e8cde3fd7595d25b3537062276b3) --- diff --git a/src/afs/afs_disconnected.c b/src/afs/afs_disconnected.c index 966d7296a..9a6bf6d0f 100644 --- a/src/afs/afs_disconnected.c +++ b/src/afs/afs_disconnected.c @@ -821,14 +821,6 @@ int afs_ProcessOpCreate(struct vcache *avc, /* Now we can set the new fid. */ memcpy(&avc->fid, &newFid, sizeof(struct VenusFid)); - if (tdp) { - /* Unset parent dir CStat flag, so it will get refreshed on next - * online stat. - */ - ObtainWriteLock(&tdp->lock, 745); - tdp->states &= ~CStatd; - ReleaseWriteLock(&tdp->lock); - } end: if (tdp) afs_PutVCache(tdp); @@ -944,16 +936,6 @@ int afs_ProcessOpRemove(struct vcache *avc, struct vrequest *areq) if (code) printf("afs_ProcessOpRemove: server returned code=%u\n", code); - /* Remove the statd flag from parent dir's vcache. */ - ObtainSharedLock(&afs_xvcache, 761); - tdp = afs_FindVCache(&pdir_fid, 0, 1); - ReleaseSharedLock(&afs_xvcache); - if (tdp) { - ObtainWriteLock(&tdp->lock, 746); - tdp->states &= ~CStatd; - ReleaseWriteLock(&tdp->lock); - afs_PutVCache(tdp); - } end: afs_osi_Free(tname, AFSNAMEMAX); return code; diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index c3a583f3b..96425415e 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -4701,6 +4701,7 @@ DECL_PIOCTL(PDiscon) afs_is_discon_rw = 0; printf("\nSync succeeded. You are back online.\n"); } + afs_ClearAllStatdFlag(); ReleaseWriteLock(&afs_discon_lock); break; diff --git a/src/afs/afs_prototypes.h b/src/afs/afs_prototypes.h index 2d09add16..b2d57d257 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -1002,7 +1002,7 @@ extern afs_int32 afs_NFSFindVCache(struct vcache **avcp, extern void afs_vcacheInit(int astatSize); extern void shutdown_vcache(void); extern void afs_DisconGiveUpCallbacks(void); - +extern void afs_ClearAllStatdFlag(void); /* VNOPS/afs_vnop_access.c */ extern afs_int32 afs_GetAccessBits(register struct vcache *avc, diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 2ea1ba75c..ae5f6db0c 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -3282,7 +3282,6 @@ shutdown_vcache(void) QInit(&afs_vhashTV[i]); } -#ifdef AFS_DISCON_ENV void afs_DisconGiveUpCallbacks() { int i; struct vcache *tvc; @@ -3307,4 +3306,25 @@ void afs_DisconGiveUpCallbacks() { /*printf("gone\n");*/ } -#endif +/*! + * + * Clear the Statd flag from all vcaches + * + * This function removes the Statd flag from all vcaches. It's used by + * disconnected mode to tidy up during reconnection + * + */ +void afs_ClearAllStatdFlag() { + int i; + struct vcache *tvc; + + ObtainWriteLock(&afs_xvcache, 715); + + for (i = 0; i < VCSIZE; i++) { + for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) { + tvc->states &= ~(CStatd|CUnique); + } + } + ReleaseWriteLock(&afs_xvcache); +} +