linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@primarydata.com>
To: "Yan, Zheng" <zheng.z.yan@intel.com>
Cc: David Howells <dhowells@redhat.com>,
	linux-fsdevel@vger.kernel.org,
	Viro Alexander <viro@zeniv.linux.org.uk>,
	linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org,
	sage@inktank.com
Subject: Re: [PATCH][RESEND] vfs: Make __d_materialise_dentry() set the materialised dentry name correctly
Date: Thu, 6 Mar 2014 09:35:01 -0500	[thread overview]
Message-ID: <6487FCC2-FB5C-4A32-94EF-5D3352A39781@primarydata.com> (raw)
In-Reply-To: <1394115376-17109-1-git-send-email-zheng.z.yan@intel.com>


On Mar 6, 2014, at 9:16, Yan, Zheng <zheng.z.yan@intel.com> wrote:

> From: David Howells <dhowells@redhat.com>
> 
> 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 <dhowells@redhat.com>
> ---
> 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;

Well spotted...

We ought to better document the fact that ’switch_names’ is asymmetrical. Perhaps change it to ‘update_target_name’, and then switch the argument names so that the ’target’ really is the thing that gets updated?

_________________________________
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@primarydata.com

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-03-06 14:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-06 14:16 [PATCH][RESEND] vfs: Make __d_materialise_dentry() set the materialised dentry name correctly Yan, Zheng
2014-03-06 14:35 ` Trond Myklebust [this message]
2014-03-07 18:55   ` J. Bruce Fields
     [not found]     ` <20140307185552.GA30256-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2014-03-07 19:01       ` J. Bruce Fields
2014-03-31  9:01   ` Yan, Zheng
     [not found]     ` <53392EDA.7000904-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-07 13:56       ` Sage Weil
2014-04-07 20:51         ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6487FCC2-FB5C-4A32-94EF-5D3352A39781@primarydata.com \
    --to=trond.myklebust@primarydata.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=sage@inktank.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zheng.z.yan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).