From patchwork Thu Mar 6 14:16:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 3783731 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0BDEB9F382 for ; Thu, 6 Mar 2014 14:16:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E31BE20225 for ; Thu, 6 Mar 2014 14:16:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D9112020A for ; Thu, 6 Mar 2014 14:16:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752053AbaCFOQ2 (ORCPT ); Thu, 6 Mar 2014 09:16:28 -0500 Received: from mga03.intel.com ([143.182.124.21]:43447 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751444AbaCFOQ1 (ORCPT ); Thu, 6 Mar 2014 09:16:27 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by azsmga101.ch.intel.com with ESMTP; 06 Mar 2014 06:16:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,600,1389772800"; d="scan'208";a="487229650" Received: from unknown (HELO zyan5-mobl.ccr.corp.intel.com) ([10.255.21.212]) by fmsmga001.fm.intel.com with ESMTP; 06 Mar 2014 06:16:24 -0800 From: "Yan, Zheng" To: dhowells@redhat.com, linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk Cc: linux-nfs@vger.kernel.org, trond.myklebust@primarydata.com, ceph-devel@vger.kernel.org, sage@inktank.com Subject: [PATCH][RESEND] vfs: Make __d_materialise_dentry() set the materialised dentry name correctly Date: Thu, 6 Mar 2014 22:16:16 +0800 Message-Id: <1394115376-17109-1-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.8.5.3 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: David Howells 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 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/dcache.c b/fs/dcache.c index 265e0ce..ff779d4 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2698,7 +2698,7 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) dparent = dentry->d_parent; - switch_names(dentry, anon); + switch_names(anon, dentry); swap(dentry->d_name.hash, anon->d_name.hash); dentry->d_parent = dentry;