Skip to content

Commit 52dba64

Browse files
author
Al Viro
committed
get rid of dead code in legitimize_root()
Combination of LOOKUP_IS_SCOPED and NULL nd->root.mnt is impossible after successful path_init(). All places where ->root.mnt might become NULL do that only if LOOKUP_IS_SCOPED is not there and path_init() itself can return success without setting nd->root only if ND_ROOT_PRESET had been set (in which case nd->root had been set by caller and never changed) or if the name had been a relative one *and* none of the bits in LOOKUP_IS_SCOPED had been present. Since all calls of legitimize_root() must be downstream of successful path_init(), the check for !nd->root.mnt && (nd->flags & LOOKUP_IS_SCOPED) is pure paranoia. FWIW, it had been discussed (and agreed upon) with Aleksa back when scoped lookups had been merged; looks like that had fallen through the cracks back then. Signed-off-by: Al Viro <[email protected]>
1 parent e5ca024 commit 52dba64

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

fs/namei.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -729,13 +729,6 @@ static bool legitimize_links(struct nameidata *nd)
729729

730730
static bool legitimize_root(struct nameidata *nd)
731731
{
732-
/*
733-
* For scoped-lookups (where nd->root has been zeroed), we need to
734-
* restart the whole lookup from scratch -- because set_root() is wrong
735-
* for these lookups (nd->dfd is the root, not the filesystem root).
736-
*/
737-
if (!nd->root.mnt && (nd->flags & LOOKUP_IS_SCOPED))
738-
return false;
739732
/* Nothing to do if nd->root is zero or is managed by the VFS user. */
740733
if (!nd->root.mnt || (nd->state & ND_ROOT_PRESET))
741734
return true;

0 commit comments

Comments
 (0)