From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sat, 27 Sep 2014 20:16:57 +0100 From: Al Viro To: Linus Torvalds Cc: Mikhail Efremov , Linux Kernel Mailing List , Miklos Szeredi , linux-fsdevel , stable Subject: Re: [PATCH v2] vfs: Don't exchange "short" filenames unconditionally. Message-ID: <20140927191657.GU7996@ZenIV.linux.org.uk> References: <1411582473-29184-1-git-send-email-sem@altlinux.org> <20140924185521.GC7996@ZenIV.linux.org.uk> <20140924201813.GI7996@ZenIV.linux.org.uk> <20140925044601.GL7996@ZenIV.linux.org.uk> <20140926164442.GA26897@ZenIV.linux.org.uk> <20140927044555.GS7996@ZenIV.linux.org.uk> <20140927183139.GT7996@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140927183139.GT7996@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org List-ID: On Sat, Sep 27, 2014 at 07:31:39PM +0100, Al Viro wrote: > We can get the long name cases right, and I agree that it'll make the > things nicer, but it might take a couple of days to get right. The thing > I'm concerned about is not screwing DCACHE_RCUACCESS up. FWIW, I suspect that the right approach is to put refcount + rcu_head in front of external name and do the following: * __d_free() checks if we have an external name, gets its containing structure and does if (atomic_dec_and_test(&name->count)) kfree(name); * switch_names() in non-exchange case (I'd probably call it copy_name, not move_names, but anyway) sets DCACHE_RCUACCESS on target (source has already gotten it from __d_rehash()), increments refcount on target's name if external and, if the source old name is external, decrements its refcount and calls kfree_rcu() if it has hit zero. AFAICS, it guarantees that we'll schedule an RCU callback on name's rch_head at most once, that we won't free it while RCU callback on it is scheduled and we won't free it until a grace period has expired since the last time it had been referenced by observable dentries. Do you see any holes in that?