return status;
 }
 
-static void set_root(struct nameidata *nd)
+static int set_root(struct nameidata *nd)
 {
        struct fs_struct *fs = current->fs;
 
                get_fs_root(fs, &nd->root);
                nd->flags |= LOOKUP_ROOT_GRABBED;
        }
+       return 0;
 }
 
 static void path_put_conditional(struct path *path, struct nameidata *nd)
 
 static int nd_jump_root(struct nameidata *nd)
 {
+       if (!nd->root.mnt) {
+               int error = set_root(nd);
+               if (error)
+                       return error;
+       }
        if (nd->flags & LOOKUP_RCU) {
                struct dentry *d;
                nd->path = nd->root;
                        return res;
        }
        if (*res == '/') {
-               if (!nd->root.mnt)
-                       set_root(nd);
-               if (unlikely(nd_jump_root(nd)))
-                       return ERR_PTR(-ECHILD);
+               error = nd_jump_root(nd);
+               if (unlikely(error))
+                       return ERR_PTR(error);
                while (unlikely(*++res == '/'))
                        ;
        }
 static inline int handle_dots(struct nameidata *nd, int type)
 {
        if (type == LAST_DOTDOT) {
-               if (!nd->root.mnt)
-                       set_root(nd);
+               int error = 0;
+
+               if (!nd->root.mnt) {
+                       error = set_root(nd);
+                       if (error)
+                               return error;
+               }
                if (nd->flags & LOOKUP_RCU) {
                        return follow_dotdot_rcu(nd);
                } else
 /* must be paired with terminate_walk() */
 static const char *path_init(struct nameidata *nd, unsigned flags)
 {
+       int error;
        const char *s = nd->name->name;
 
        if (!*s)
        nd->path.dentry = NULL;
 
        nd->m_seq = read_seqbegin(&mount_lock);
+
+       /* Figure out the starting path and root (if needed). */
        if (*s == '/') {
-               set_root(nd);
-               if (likely(!nd_jump_root(nd)))
-                       return s;
-               return ERR_PTR(-ECHILD);
+               error = nd_jump_root(nd);
+               if (unlikely(error))
+                       return ERR_PTR(error);
+               return s;
        } else if (nd->dfd == AT_FDCWD) {
                if (flags & LOOKUP_RCU) {
                        struct fs_struct *fs = current->fs;