From: David Howells Subject: [PATCH] Make __d_materialise_dentry() set the materialised dentry name correctly Date: Thu, 12 Jun 2008 11:53:38 +0100 Message-ID: <20080612105338.12959.32251.stgit@warthog.procyon.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: yanzheng@21cn.com, dhowells@redhat.com, nfsv4@linux-nfs.org, linux-fsdevel@vger.kernel.org To: viro@ftp.linux.org.uk, Trond.Myklebust@netapp.com Return-path: Received: from mx1.redhat.com ([66.187.233.31]:40785 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753730AbYFLKyK (ORCPT ); Thu, 12 Jun 2008 06:54:10 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Make __d_materialise_dentry() set the materialised dentry name correctly by flipping the arguments to switch_names(). switch_names() is lazy: if both names are internal to their dentries, it'll overwrite that of the first dentry with that of the second, and won't update that of the second. In the case of __d_materialise_dentry(), the second is an already extant anonymous dentry that we want to insert into the tree in place of the dentry we just looked up[*]. However, the dentry we just looked up carries the name we actually want to use. [*] This is used by NFS to join a mount of a subtree into a mount of a tree nearer the root when the two meet, where both mounts share a superblock and thus a set of dentries. Signed-off-by: David Howells --- fs/dcache.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index 3ee588d..8ae660e 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1649,7 +1649,7 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) { struct dentry *dparent, *aparent; - switch_names(dentry, anon); + switch_names(anon, dentry); do_switch(dentry->d_name.len, anon->d_name.len); do_switch(dentry->d_name.hash, anon->d_name.hash);