]> Git Repo - linux.git/commitdiff
get rid of dead code in legitimize_root()
authorAl Viro <[email protected]>
Fri, 7 Jan 2022 17:24:41 +0000 (12:24 -0500)
committerAl Viro <[email protected]>
Fri, 20 May 2022 03:26:29 +0000 (23:26 -0400)
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]>
fs/namei.c

index 9e327d0717d0893831b8250c74a0caebf3dc73f7..69e6ba7c407b25f35df75eaea437f197f65d050c 100644 (file)
@@ -729,13 +729,6 @@ static bool legitimize_links(struct nameidata *nd)
 
 static bool legitimize_root(struct nameidata *nd)
 {
-       /*
-        * For scoped-lookups (where nd->root has been zeroed), we need to
-        * restart the whole lookup from scratch -- because set_root() is wrong
-        * for these lookups (nd->dfd is the root, not the filesystem root).
-        */
-       if (!nd->root.mnt && (nd->flags & LOOKUP_IS_SCOPED))
-               return false;
        /* Nothing to do if nd->root is zero or is managed by the VFS user. */
        if (!nd->root.mnt || (nd->state & ND_ROOT_PRESET))
                return true;
This page took 0.062795 seconds and 4 git commands to generate.