* [PATCH][RESEND] vfs: Make __d_materialise_dentry() set the materialised dentry name correctly
@ 2014-03-06 14:16 Yan, Zheng
2014-03-06 14:35 ` Trond Myklebust
0 siblings, 1 reply; 7+ messages in thread
From: Yan, Zheng @ 2014-03-06 14:16 UTC (permalink / raw)
To: dhowells, linux-fsdevel, viro
Cc: linux-nfs, trond.myklebust, ceph-devel, sage
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;
--
1.8.5.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH][RESEND] vfs: Make __d_materialise_dentry() set the materialised dentry name correctly
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
2014-03-07 18:55 ` J. Bruce Fields
2014-03-31 9:01 ` Yan, Zheng
0 siblings, 2 replies; 7+ messages in thread
From: Trond Myklebust @ 2014-03-06 14:35 UTC (permalink / raw)
To: Yan, Zheng
Cc: David Howells, linux-fsdevel, Viro Alexander, linux-nfs,
ceph-devel, sage
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][RESEND] vfs: Make __d_materialise_dentry() set the materialised dentry name correctly
2014-03-06 14:35 ` Trond Myklebust
@ 2014-03-07 18:55 ` J. Bruce Fields
[not found] ` <20140307185552.GA30256-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
2014-03-31 9:01 ` Yan, Zheng
1 sibling, 1 reply; 7+ messages in thread
From: J. Bruce Fields @ 2014-03-07 18:55 UTC (permalink / raw)
To: Trond Myklebust
Cc: Yan, Zheng, David Howells, linux-fsdevel, Viro Alexander,
linux-nfs, ceph-devel, sage
On Thu, Mar 06, 2014 at 09:35:01AM -0500, Trond Myklebust wrote:
>
> 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?
Probably not worth it if Miklos's RENAME_EXCHANGE operation is making it
symmetrical soon anyway?:
http://mid.gmane.org/<1380643239-16060-4-git-send-email-miklos@szeredi.hu>
--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][RESEND] vfs: Make __d_materialise_dentry() set the materialised dentry name correctly
[not found] ` <20140307185552.GA30256-uC3wQj2KruNg9hUCZPvPmw@public.gmane.org>
@ 2014-03-07 19:01 ` J. Bruce Fields
0 siblings, 0 replies; 7+ messages in thread
From: J. Bruce Fields @ 2014-03-07 19:01 UTC (permalink / raw)
To: Trond Myklebust
Cc: Yan, Zheng, David Howells, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
Viro Alexander, linux-nfs-u79uwXL29TY76Z2rM5mHXA,
ceph-devel-u79uwXL29TY76Z2rM5mHXA, sage-4GqslpFJ+cxBDgjK7y7TUQ
On Fri, Mar 07, 2014 at 01:55:52PM -0500, J. Bruce Fields wrote:
> On Thu, Mar 06, 2014 at 09:35:01AM -0500, Trond Myklebust wrote:
> >
> > On Mar 6, 2014, at 9:16, Yan, Zheng <zheng.z.yan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> >
> > > From: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > >
> > > 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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > > ---
> > > 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?
>
> Probably not worth it if Miklos's RENAME_EXCHANGE operation is making it
> symmetrical soon anyway?:
>
> http://mid.gmane.org/<1380643239-16060-4-git-send-email-miklos@szeredi.hu>
To clarify: I mean, the suggested cleanup may not be worth it. The
__d_materialise_dentry bugfix of course is.
(What I wonder about is the duplication between this and __d_move. Is
there any way to make d_materialise_unique a special case of d_move?)
--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][RESEND] vfs: Make __d_materialise_dentry() set the materialised dentry name correctly
2014-03-06 14:35 ` Trond Myklebust
2014-03-07 18:55 ` J. Bruce Fields
@ 2014-03-31 9:01 ` Yan, Zheng
[not found] ` <53392EDA.7000904-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
1 sibling, 1 reply; 7+ messages in thread
From: Yan, Zheng @ 2014-03-31 9:01 UTC (permalink / raw)
To: Viro Alexander
Cc: Trond Myklebust, David Howells, linux-fsdevel, linux-nfs,
ceph-devel, sage
Hi Al,
Could you include this in 3.15
Regards
Yan, Zheng
On 03/06/2014 10:35 PM, Trond Myklebust wrote:
>
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][RESEND] vfs: Make __d_materialise_dentry() set the materialised dentry name correctly
[not found] ` <53392EDA.7000904-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2014-04-07 13:56 ` Sage Weil
2014-04-07 20:51 ` J. Bruce Fields
0 siblings, 1 reply; 7+ messages in thread
From: Sage Weil @ 2014-04-07 13:56 UTC (permalink / raw)
To: Viro Alexander
Cc: Yan, Zheng, Trond Myklebust, David Howells,
linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
linux-nfs-u79uwXL29TY76Z2rM5mHXA,
ceph-devel-u79uwXL29TY76Z2rM5mHXA
Hi Al,
Can this go to Linus via your tree?
Thanks!
sage
On Mon, 31 Mar 2014, Yan, Zheng wrote:
> Hi Al,
>
> Could you include this in 3.15
>
> Regards
> Yan, Zheng
>
> On 03/06/2014 10:35 PM, Trond Myklebust wrote:
> >
> > On Mar 6, 2014, at 9:16, Yan, Zheng <zheng.z.yan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> >
> >> From: David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> >>
> >> 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-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> >> ---
> >> 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-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org
> >
>
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][RESEND] vfs: Make __d_materialise_dentry() set the materialised dentry name correctly
2014-04-07 13:56 ` Sage Weil
@ 2014-04-07 20:51 ` J. Bruce Fields
0 siblings, 0 replies; 7+ messages in thread
From: J. Bruce Fields @ 2014-04-07 20:51 UTC (permalink / raw)
To: Sage Weil
Cc: Viro Alexander, Yan, Zheng, Trond Myklebust, David Howells,
linux-fsdevel, linux-nfs, ceph-devel
On Mon, Apr 07, 2014 at 06:56:28AM -0700, Sage Weil wrote:
> Hi Al,
>
> Can this go to Linus via your tree?
I believe this has been fixed by
da1ce0670c14d8380e423a3239e562a1dc15fa9e "vfs: add cross-rename".
Though probably the patch should still go in, possibly with a changelog
update. We want it for stable kernels if nothing else.
--b.
>
> Thanks!
> sage
>
>
> On Mon, 31 Mar 2014, Yan, Zheng wrote:
>
> > Hi Al,
> >
> > Could you include this in 3.15
> >
> > Regards
> > Yan, Zheng
> >
> > On 03/06/2014 10:35 PM, Trond Myklebust wrote:
> > >
> > > 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
> >
> >
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-04-07 20:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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).