From: "J. Bruce Fields" Subject: Re: [git pull] vfs and fs fixes Date: Tue, 17 Apr 2012 12:22:16 -0400 Message-ID: <20120417162216.GB27426@fieldses.org> References: <20120417052511.GU6589@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Al Viro , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Linus Torvalds Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Tue, Apr 17, 2012 at 08:01:48AM -0700, Linus Torvalds wrote: > On Mon, Apr 16, 2012 at 10:25 PM, Al Viro w= rote: > > =C2=A0 =C2=A0 =C2=A0 =C2=A0A bunch of endianness fixes plus a patch= from bfields untangling > > dependencies between vfs and nfsd trees; in principle, we could kee= p it > > in nfsd tree (along with a bunch of followups that definitely belon= g there), > > but Miklos' stuff in fs/namei.c steps fairly close to it and overla= yfs > > and unionfs series - even closer, so that would create serious PITA= for > > both, whichever tree it would sit in. >=20 > Why is that double mutex taking in vfs_rename_other() safe from ABBA? >=20 > We aren't guaranteed to hold the s_vfs_rename_mutex, since the parent > directories may be the same. >=20 > And yes, we hold the i_mutex on that shared parent, but the inodes ma= y > exist (hardlinked) in another directory, so another rename could be > doing the i_mutex in the reverse order. >=20 > Maybe there is some reason why that double lock is safe, but I don't > see it, and I want it clearly documented. So I'm not pulling this. Ugh, no, I think you're right: rename A/a->A/b rename B/b->B/b where A/a and B/a are the same file, and A/b and B/b are the same file, can result in the first rename holding the lock on A and a and waiting on b, and the second holding the lock on B and b and waiting on a. --b.