From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: fs/dcache.c - BUG: soft lockup - CPU#5 stuck for 22s! [systemd-udevd:1667] Date: Wed, 28 May 2014 15:19:37 +0100 Message-ID: <20140528141937.GZ18016@ZenIV.linux.org.uk> References: <20140526182644.GP18016@ZenIV.linux.org.uk> <20140527014054.GR18016@ZenIV.linux.org.uk> <20140527031415.GS18016@ZenIV.linux.org.uk> <20140527040026.GT18016@ZenIV.linux.org.uk> <20140527070409.GA1801@lahna.fi.intel.com> <20140528031955.GW18016@ZenIV.linux.org.uk> <20140528073751.GB1757@lahna.fi.intel.com> <20140528115701.GY18016@ZenIV.linux.org.uk> <20140528131136.GA1643@lahna.fi.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Linus Torvalds , Linux Kernel Mailing List , Miklos Szeredi , linux-fsdevel To: Mika Westerberg Return-path: Content-Disposition: inline In-Reply-To: <20140528131136.GA1643@lahna.fi.intel.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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...