Re: fs/dcache.c - BUG: soft lockup - CPU#5 stuck for 22s! [systemd-udevd:1667]

From: Al Viro
Date: Wed May 28 2014 - 10:19:47 EST


On Wed, May 28, 2014 at 04:11:36PM +0300, Mika Westerberg wrote:

> I added this on top of your previus patch and unfortunately the livelock
> is still there :-(
>
> >From the previous log, it looks like udev is doing exactly same operation
> (check_submounts_and_drop) on 4 of the CPUs in paraller:

4 threads trying to resolve some pathnames in that subtree for some reason.
All of them hitting ->d_revalidate() on the spot - basically, the first
invalidated directory...

OK, it's not ->i_lock, it's ->d_lock on parent being grabbed after that on
child, while d_walk() keeps taking them in opposite order. Hmm...

In principle we could do the following:
* split dentry_kill() into the part that is taking locks and
the rest of it.
* in case of trylock failure have shrink_dentry_list() do
read_seqlock_excl(&rename_lock) (which will stabilize ->d_parent) and
take ->d_lock in the right order, drop rename_lock and call __dentry_kill().

AFAICS, that would kill the livelock for good. We still have ->i_lock
trylock failures to deal with, but those are less of a problem - d_walk()
won't step on ->i_lock at all. I'm going to grab a couple of hours of sleep
and try to put together something along those lines...
--
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/