On Wed, May 28, 2014 at 02:11:51PM -0700, Linus Torvalds wrote: > > d_walk() covers its arse with ->d_lock (and it wants the starting point > > to be pinned, obviously). So AFAICS RCU is not a problem. > > It's not RCU itself, it's that DCACHE_MAY_FREE bit. Yes, d_walk() gets > ->d_lock, but dentry_kill() drops d_lock in the middle, and the whole > "dentry_kill() can get called multiple times for the same dentry" just > makes me go "Hmm". It is *not* obvious what happens the second vs > third time that gets called. If it can get called two times, why not > three times? dentry_kill(dentry, 1) can only be called when ->d_count had been positive up to the point of caller grabbing ->d_lock. And it either does lockref_mark_dead() before dropping ->d_lock or it fails trylock and buggers off having done nothing, including changes of ->d_count. In case of dentry_kill(dentry, 0), ->d_lock has been held since the moment dentry had been found on shrink list. It either does nothing and dentry gets returned to the same shrink list without ever dropping ->d_lock (or changing refcount) or it does lockref_mark_dead() before dropping ->d_lock. In the latter case dentry will *not* be put on any shrink lists again. So we have at most one call of the first kind getting past the trylocks and at most one call of the second kind doing the same. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html