Re: [RFC PATCH] shrink_dcache_parent() deadlock
From: Linus Torvalds
Date: Mon Jan 09 2012 - 14:18:39 EST
On Mon, Jan 9, 2012 at 11:04 AM, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
>
> After Dave's patch select_parent isolates dentries that are going to
> be dropped directly to an on-stack list instead of abusing the LRU.
>
> With that scheme the trylock and retry loop in __shrink_dcache_sb
> goes away completely for this caller.
Yes, but it still exists for the prune_dcache_sb() case.
So prune_dcache_sb() puts random dentries on its own private lists,
and drops the lru_lock (and the dentry lock).
In the meantime, what protects us from select_parent() finding those
*same* dentries, and doing
dentry_lru_move_list(dentry, dispose);
which - despite the name - moves the dentry not from the lru list, but
from the prune_dcache_sb local list to the select_parent() local
list..
Hmm. I guess the endless "move back-and-forth" thing is gone, but the
random "move from one private list to another" makes me worry about
the confusion.
But I guess we don't care - the same thing is going to happen to the
dentry regardless of which of the local lists it is on.
And in any case, I think Dave's patch looks like a nice cleanup. Does
it work for people in that forward-ported-alone version I sent out?
And Miklos, does it fix your test-case? Because if so, I think Dave's
patch is nicer, and avoids adding a new state bit by just cleaning
things up in general.
Linus
--
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/