lkml.org 
[lkml]   [2006]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] Fix shrink_dcache_parent() against shrink_dcache_memory() race (3rd updated patch)]
    On Fri, Mar 10, 2006 at 01:31:53PM +0100, Jan Blunck wrote:
    > On Fri, Mar 10, Neil Brown wrote:
    >
    > > -static void prune_dcache(int count)
    > > +static void prune_dcache(int count, struct super_block *sb)
    > > {
    > > spin_lock(&dcache_lock);
    > > for (; count ; count--) {
    > > @@ -417,8 +425,10 @@ static void prune_dcache(int count)
    > > spin_unlock(&dentry->d_lock);
    > > continue;
    > > }
    > > - /* If the dentry was recently referenced, don't free it. */
    > > - if (dentry->d_flags & DCACHE_REFERENCED) {
    > > + /* If the dentry was recently referenced, or is for
    > > + * a unmounting filesystem, don't free it. */
    > > + if ((dentry->d_flags & DCACHE_REFERENCED) ||
    > > + (dentry->d_sb != sb && dentry->d_sb->s_root == NULL)) {
    > > dentry->d_flags &= ~DCACHE_REFERENCED;
    > > list_add(&dentry->d_lru, &dentry_unused);
    > > dentry_stat.nr_unused++;
    >
    > You have to down_read the rw-semaphore sb->s_umount since sb->s_root is
    > protected by it :(

    <snip>

    Please do not beat me up for suggesting this. I was wondering if it
    makes sense to add a PF_SHRINKER flag and set it in shrink_slab().
    Use my solution, instead of PF_MEMALLOC check against PF_SHRINKER.

    I think PF_SHRINKER might be a good idea, it might help us detect
    races between the shrinker and other subsystems too - not only dcache.

    It might be well worth adding in. If there is sufficient interest I can
    send create and send out a patch.

    Balbir
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-03-10 18:20    [W:0.030 / U:62.184 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site