• Andrew Morton's avatar
    [PATCH] Fix and clean up DCACHE_REFERENCED usage · 0e3efbd1
    Andrew Morton authored
    From: Maneesh Soni <maneesh@in.ibm.com>
    
    This patch changes the way DCACHE_REFERENCED flag is used. It
    got messed up in dcache_rcu iterations. I hope this will be ok now.
    
    The flag was meant to be advisory flag which is used while
    prune_dcache() so as not to free dentries which have recently
    entered d_lru list. At first pass in prune_dcache the dentries
    marked DCACHE_REFERENCED are left with the flag reset. and they
    are freed in the next pass.
    
    So, now we mark the dentry as DCACHE_REFERENCED when it is first
    entering the d_lru list in dput() and resetthe flag in prune_dcache().
    If the flag remains reset in the next call to prune_dcache(), the
    dentry is then freed.
    
    Also I don't think any file system have to use this flag as it is taken
    care by the dcache layer. The patch removes such code from a few of file
    systems. Moreover these filesystems were anyway doing worng thing as they
    were changing the flag out of dcache_lock.
    
    Changes:
    o dput() marks dentry DCACHE_REFERENCED when it is added to the dentry_unused
      list
    o no need to set the flag in dget, dget_locked, d_lookup as these guys anyway
      increments the ref count.
    o check the ref count in prune_dcache and use DCACHE_REFERENCED flag just for
      two stage aging.
    o remove code for setting DACACHE_REFERENCED from reiserfs, fat, xfs and
      exportfs.
    0e3efbd1
dcache.c 40.6 KB