libafs: avoid flushing already freed dcaches in flush volumes
authorMichael Meffie <mmeffie@sinenomine.net>
Thu, 7 Jun 2012 17:54:20 +0000 (13:54 -0400)
committerDerrick Brashear <shadow@dementix.org>
Sun, 22 Jul 2012 12:25:30 +0000 (05:25 -0700)
When flushing volume data, skip flushing dcache entries which
are already freed.

Change-Id: I74d7e055e833dc91214dd9d544af3781f74db59b
Reviewed-on: http://gerrit.openafs.org/7539
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/afs/afs_pioctl.c

index 6283a59..aab52ff 100644 (file)
@@ -3544,12 +3544,14 @@ DECL_PIOCTL(PFlushVolumeData)
        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);