#endif /* AFS_NEED_CLIENTCONTEXT */
if (vp) {
#ifdef AFS_LINUX22_ENV
+ /*
+ * Holding the global lock when calling dput can cause a deadlock
+ * when the kernel calls back into afs_dentry_iput
+ */
+ AFS_GUNLOCK();
dput(dp);
+ AFS_GLOCK();
#else
#if defined(AFS_FBSD80_ENV)
if (VOP_ISLOCKED(vp))
afs_BozonLock(&avc->pvnLock, avc); /* Since afs_TryToSmush will do a pvn_vptrunc */
#endif
ObtainWriteLock(&avc->lock, 225);
- afs_ResetVCache(avc, *acred);
+ afs_ResetVCache(avc, *acred, 0);
ReleaseWriteLock(&avc->lock);
#ifdef AFS_BOZONLOCK_ENV
afs_BozonUnlock(&avc->pvnLock, avc);
afs_BozonLock(&tvc->pvnLock, tvc); /* Since afs_TryToSmush will do a pvn_vptrunc */
#endif
ObtainWriteLock(&tvc->lock, 232);
-
- ObtainWriteLock(&afs_xcbhash, 458);
- afs_DequeueCallback(tvc);
- tvc->f.states &= ~(CStatd | CDirty);
- ReleaseWriteLock(&afs_xcbhash);
- if (tvc->f.fid.Fid.Vnode & 1 || (vType(tvc) == VDIR))
- osi_dnlc_purgedp(tvc);
- afs_TryToSmush(tvc, *acred, 1);
+ afs_ResetVCache(tvc, *acred, 1);
ReleaseWriteLock(&tvc->lock);
#ifdef AFS_BOZONLOCK_ENV
afs_BozonUnlock(&tvc->pvnLock, tvc);
if (tdc->refCount <= 1) { /* too high, in use by running sys call */
ReleaseReadLock(&tdc->tlock);
if (tdc->f.fid.Fid.Volume == volume && tdc->f.fid.Cell == cell) {
- if (!(afs_indexFlags[i] & IFDataMod)) {
+ if (!(afs_indexFlags[i] & (IFDataMod | IFFree | IFDiscarded))) {
/* if the file is modified, but has a ref cnt of only 1,
* then someone probably has the file open and is writing
* into it. Better to skip flushing such a file, it will be
* brought back immediately on the next write anyway.
*
+ * Skip if already freed.
+ *
* If we *must* flush, then this code has to be rearranged
* to call afs_storeAllSegments() first */
afs_FlushDCache(tdc);