Re: [PATCH] Fix shrink_dcache_parent() against shrink_dcache_memory() race (updated patch)

From: Jan Blunck
Date: Thu Mar 09 2006 - 11:06:54 EST


On Thu, Mar 09, Kirill Korotaev wrote:

> commented your patch a bit.
> and attached a corrected version. please review it.
>

Thanks! I'll send the corrected patch.

So, everythings fine now?


> > d_free(dentry);
> > if (parent != dentry)
> > dput(parent);
> > spin_lock(&dcache_lock);
> >+ sb->s_prunes--;
> >+ if (likely(!sb->s_prunes))
> <<< Is it possibe to do something like:
> if (unlikely(!sb->s_root && !sb->s_prunes))
> ?

Uh, I forgot about that one. You already complained about that before :(

> > void shrink_dcache_parent(struct dentry * parent)
> > {
> > int found;
> >+ struct super_block *sb = parent->d_sb;
> >
> >+ again:
> > while ((found = select_parent(parent)) != 0)
> > prune_dcache(found);
> >+
> >+ /* If we are called from generic_shutdown_super() during
> >+ * umount of a filesystem, we want to check for other prunes */
> >+ if (!sb->s_root && wait_on_prunes(sb))
> >+ goto again;
> <<<< I don't like this loop here as it looks like a hack for some
> special case.
> better to move it to generic_shutdown() and omit sb->s_root check at all.
>

Yes, looks a little cleaner though.

Regards,
Jan

--
Jan Blunck jblunck@xxxxxxx
SuSE LINUX AG - A Novell company
Maxfeldstr. 5 +49-911-74053-608
D-90409 Nürnberg http://www.suse.de
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/