From 58ab0e7c58e1e8cde3fd7595d25b3537062276b3 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Sun, 25 Jan 2009 14:48:14 +0000 Subject: [PATCH] disconnected-clear-cstatd-on-reconnect-20090125 LICENSE IPL10 FIXES 124180 don't treat any information we forged as being valid while offline as valid --- src/afs/afs_disconnected.c | 18 ------------------ src/afs/afs_pioctl.c | 1 + src/afs/afs_prototypes.h | 2 +- src/afs/afs_vcache.c | 24 ++++++++++++++++++++++-- 4 files changed, 24 insertions(+), 21 deletions(-) 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 4453dd2c0..23fd94636 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 afc12d7a3..86c55642f 100644 --- a/src/afs/afs_prototypes.h +++ b/src/afs/afs_prototypes.h @@ -1003,7 +1003,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 511dfa68a..fef566836 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); +} + -- 2.39.5