From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm@xmission.com (Eric W. Biederman) Subject: Re: [PATCH 02/11] vfs: More precise tests in d_invalidate Date: Sat, 15 Feb 2014 15:23:20 -0800 Message-ID: <87a9ds55av.fsf@xmission.com> References: <87a9kkax0j.fsf@xmission.com> <8761v7h2pt.fsf@tw-ebiederman.twitter.com> <87li281wx6.fsf_-_@xmission.com> <87ob28kqks.fsf_-_@xmission.com> <87bny8kqik.fsf_-_@xmission.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Al Viro , "Serge E. Hallyn" , Linux-Fsdevel , Kernel Mailing List , Andy Lutomirski , Rob Landley , Miklos Szeredi , Christoph Hellwig , Karel Zak , "J. Bruce Fields" To: Linus Torvalds Return-path: In-Reply-To: (Linus Torvalds's message of "Sat, 15 Feb 2014 14:59:50 -0800") Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Linus Torvalds writes: > On Sat, Feb 15, 2014 at 2:51 PM, Linus Torvalds > wrote: >> >> the whole check_submounts_and_drop thing walks the parent chain and >> locks each parent with the renamelock held for writing. > > Oops, my bad about the write lock, brainfart due to grepping and > reading the wrong context... > > check_submounts_and_drop() doesn't do the parent walk with the rename > lock held for writing, it just holds it for reading. > > But it does do that very complex "walk parents and check all siblings" > and locks them, so the rest of the commentary was correct. Except that today d_invalidate drops the dcache lock and calls shrink_dcache_parent. Which gets you into exactly the same complex "walk parents and check all siblings" code. The only difference between the shrink_dcache_parent and check_submounts_and_drop (not counting the final drop) is that check_submounts_and_drop aborts when it encounters a dentry with d_mountpoint set. So no I am not trying to hide something. I called out that I changed this logic in particular and this particular patch all I am doing is killing the enforcing of 2.2 era logic. Further I front loaded this change so I bisect could point it's fingers at this before any other substantial changes were made if this is indeed a problem. Beyond that check_submounts_and_drop is what well maintained distributed filesystems are calling from d_revalidate. Now I would not be surprised if this change to d_invalidate is a challenge to get your head around. It took me a while of reading the code to realize (a) how the code makes some degree of sense today, and (b) that the change is semantically safe. But when shrink_dcache_parent and check_submounts_and_drop are effectiely the same function I can't possibly see how you can argue how the locking has changed or that I am trying to hide things. Eric