All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] walk_component(): get inode in lookup_slow branch statement block
@ 2022-06-22  8:51 sunliming
  2022-06-22 10:34 ` Al Viro
  0 siblings, 1 reply; 7+ messages in thread
From: sunliming @ 2022-06-22  8:51 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, linux-kernel, sunliming, kelulanainsley, sunliming

The inode variable is used as a parameter by the step_into function,
but is not assigned a value in the sub-lookup_slow branch path. So
get the inode in the sub-lookup_slow branch path.

Signed-off-by: sunliming <sunliming@kylinos.cn>
---
 fs/namei.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/namei.c b/fs/namei.c
index 1f28d3f463c3..a1a3e9514f46 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2014,6 +2014,8 @@ static const char *walk_component(struct nameidata *nd, int flags)
 		dentry = lookup_slow(&nd->last, nd->path.dentry, nd->flags);
 		if (IS_ERR(dentry))
 			return ERR_CAST(dentry);
+
+		inode = d_backing_inode(dentry);
 	}
 	if (!(flags & WALK_MORE) && nd->depth)
 		put_link(nd);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] walk_component(): get inode in lookup_slow branch statement block
  2022-06-22  8:51 [PATCH] walk_component(): get inode in lookup_slow branch statement block sunliming
@ 2022-06-22 10:34 ` Al Viro
  2022-06-23  3:26   ` sunliming
  2022-06-23  3:44   ` sunliming
  0 siblings, 2 replies; 7+ messages in thread
From: Al Viro @ 2022-06-22 10:34 UTC (permalink / raw)
  To: sunliming; +Cc: linux-fsdevel, linux-kernel, sunliming, kelulanainsley

On Wed, Jun 22, 2022 at 04:51:46PM +0800, sunliming wrote:
> The inode variable is used as a parameter by the step_into function,
> but is not assigned a value in the sub-lookup_slow branch path. So
> get the inode in the sub-lookup_slow branch path.

Take a good look at handle_mounts() and the things it does when
*not* in RCU mode (i.e. LOOKUP_RCU is not set).  Specifically,
                *inode = d_backing_inode(path->dentry);
		*seqp = 0; /* out of RCU mode, so the value doesn't matter */
this part.

IOW, the values passed to step_into() in inode/seq are overridden unless
we stay in RCU mode.  And if we'd been through lookup_slow(), we'd been
out of RCU mode since before we called step_into().

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] walk_component(): get inode in lookup_slow branch statement block
  2022-06-22 10:34 ` Al Viro
@ 2022-06-23  3:26   ` sunliming
  2022-06-23  3:44   ` sunliming
  1 sibling, 0 replies; 7+ messages in thread
From: sunliming @ 2022-06-23  3:26 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, linux-kernel, sunliming

Al Viro <viro@zeniv.linux.org.uk> 于2022年6月22日周三 18:35写道:
>
> On Wed, Jun 22, 2022 at 04:51:46PM +0800, sunliming wrote:
> > The inode variable is used as a parameter by the step_into function,
> > but is not assigned a value in the sub-lookup_slow branch path. So
> > get the inode in the sub-lookup_slow branch path.
>
> Take a good look at handle_mounts() and the things it does when
> *not* in RCU mode (i.e. LOOKUP_RCU is not set).  Specifically,
>                 *inode = d_backing_inode(path->dentry);
>                 *seqp = 0; /* out of RCU mode, so the value doesn't matter */
> this part.
>
> IOW, the values passed to step_into() in inode/seq are overridden unless
> we stay in RCU mode.  And if we'd been through lookup_slow(), we'd been
> out of RCU mode since before we called step_into().
OK,I got it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] walk_component(): get inode in lookup_slow branch statement block
  2022-06-22 10:34 ` Al Viro
  2022-06-23  3:26   ` sunliming
@ 2022-06-23  3:44   ` sunliming
  2022-06-23  3:48     ` Al Viro
  1 sibling, 1 reply; 7+ messages in thread
From: sunliming @ 2022-06-23  3:44 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, linux-kernel, sunliming

Al Viro <viro@zeniv.linux.org.uk> 于2022年6月22日周三 18:35写道:
>
> On Wed, Jun 22, 2022 at 04:51:46PM +0800, sunliming wrote:
> > The inode variable is used as a parameter by the step_into function,
> > but is not assigned a value in the sub-lookup_slow branch path. So
> > get the inode in the sub-lookup_slow branch path.
>
> Take a good look at handle_mounts() and the things it does when
> *not* in RCU mode (i.e. LOOKUP_RCU is not set).  Specifically,
>                 *inode = d_backing_inode(path->dentry);
>                 *seqp = 0; /* out of RCU mode, so the value doesn't matter */
> this part.
>
> IOW, the values passed to step_into() in inode/seq are overridden unless
> we stay in RCU mode.  And if we'd been through lookup_slow(), we'd been
> out of RCU mode since before we called step_into().

It might be more appropriate and easier to understand to do this
before parameter passing in the top-level  walk_component function?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] walk_component(): get inode in lookup_slow branch statement block
  2022-06-23  3:44   ` sunliming
@ 2022-06-23  3:48     ` Al Viro
  2022-06-23  9:57       ` sunliming
  0 siblings, 1 reply; 7+ messages in thread
From: Al Viro @ 2022-06-23  3:48 UTC (permalink / raw)
  To: sunliming; +Cc: linux-fsdevel, linux-kernel, sunliming

On Thu, Jun 23, 2022 at 11:44:29AM +0800, sunliming wrote:
> Al Viro <viro@zeniv.linux.org.uk> 于2022年6月22日周三 18:35写道:
> >
> > On Wed, Jun 22, 2022 at 04:51:46PM +0800, sunliming wrote:
> > > The inode variable is used as a parameter by the step_into function,
> > > but is not assigned a value in the sub-lookup_slow branch path. So
> > > get the inode in the sub-lookup_slow branch path.
> >
> > Take a good look at handle_mounts() and the things it does when
> > *not* in RCU mode (i.e. LOOKUP_RCU is not set).  Specifically,
> >                 *inode = d_backing_inode(path->dentry);
> >                 *seqp = 0; /* out of RCU mode, so the value doesn't matter */
> > this part.
> >
> > IOW, the values passed to step_into() in inode/seq are overridden unless
> > we stay in RCU mode.  And if we'd been through lookup_slow(), we'd been
> > out of RCU mode since before we called step_into().
> 
> It might be more appropriate and easier to understand to do this
> before parameter passing in the top-level  walk_component function?

It's possible to fall out of RCU mode *inside* step_into(), so we need
it done there anyway.  Unfortunately ;-/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] walk_component(): get inode in lookup_slow branch statement block
  2022-06-23  3:48     ` Al Viro
@ 2022-06-23  9:57       ` sunliming
  0 siblings, 0 replies; 7+ messages in thread
From: sunliming @ 2022-06-23  9:57 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, linux-kernel, sunliming

Al Viro <viro@zeniv.linux.org.uk> 于2022年6月23日周四 11:48写道:
>
> On Thu, Jun 23, 2022 at 11:44:29AM +0800, sunliming wrote:
> > Al Viro <viro@zeniv.linux.org.uk> 于2022年6月22日周三 18:35写道:
> > >
> > > On Wed, Jun 22, 2022 at 04:51:46PM +0800, sunliming wrote:
> > > > The inode variable is used as a parameter by the step_into function,
> > > > but is not assigned a value in the sub-lookup_slow branch path. So
> > > > get the inode in the sub-lookup_slow branch path.
> > >
> > > Take a good look at handle_mounts() and the things it does when
> > > *not* in RCU mode (i.e. LOOKUP_RCU is not set).  Specifically,
> > >                 *inode = d_backing_inode(path->dentry);
> > >                 *seqp = 0; /* out of RCU mode, so the value doesn't matter */
> > > this part.
> > >
> > > IOW, the values passed to step_into() in inode/seq are overridden unless
> > > we stay in RCU mode.  And if we'd been through lookup_slow(), we'd been
> > > out of RCU mode since before we called step_into().
> >
> > It might be more appropriate and easier to understand to do this
> > before parameter passing in the top-level  walk_component function?
>
> It's possible to fall out of RCU mode *inside* step_into(), so we need
> it done there anyway.  Unfortunately ;-/
Thanks for your explanation

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] walk_component(): get inode in lookup_slow branch statement block
@ 2022-06-22  8:53 sunliming
  0 siblings, 0 replies; 7+ messages in thread
From: sunliming @ 2022-06-22  8:53 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, linux-kernel, sunliming, kelulanainsley

The inode variable is used as a parameter by the step_into function,
but is not assigned a value in the sub-lookup_slow branch path. So
get the inode in the sub-lookup_slow branch path.

Signed-off-by: sunliming <sunliming@kylinos.cn>
---
 fs/namei.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/namei.c b/fs/namei.c
index 1f28d3f463c3..a1a3e9514f46 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2014,6 +2014,8 @@ static const char *walk_component(struct nameidata *nd, int flags)
 		dentry = lookup_slow(&nd->last, nd->path.dentry, nd->flags);
 		if (IS_ERR(dentry))
 			return ERR_CAST(dentry);
+
+		inode = d_backing_inode(dentry);
 	}
 	if (!(flags & WALK_MORE) && nd->depth)
 		put_link(nd);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-23  9:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22  8:51 [PATCH] walk_component(): get inode in lookup_slow branch statement block sunliming
2022-06-22 10:34 ` Al Viro
2022-06-23  3:26   ` sunliming
2022-06-23  3:44   ` sunliming
2022-06-23  3:48     ` Al Viro
2022-06-23  9:57       ` sunliming
2022-06-22  8:53 sunliming

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.