* parent relationships.
*/
if (unlikely(type != LAST_NORM)) {
- if (handle_dots(nd, type))
- return -ECHILD;
+ err = handle_dots(nd, type);
+ if (err)
+ goto return_err;
continue;
}
if (lookup_flags & LOOKUP_PARENT)
goto lookup_parent;
if (unlikely(type != LAST_NORM)) {
- if (handle_dots(nd, type))
- return -ECHILD;
+ err = handle_dots(nd, type);
+ if (err)
+ goto return_err;
return 0;
}
err = do_lookup(nd, &this, &next, &inode);
if (!(nd->flags & LOOKUP_RCU))
path_put(&nd->path);
return_err:
+ if (nd->flags & LOOKUP_RCU) {
+ nd->flags &= ~LOOKUP_RCU;
+ nd->root.mnt = NULL;
+ rcu_read_unlock();
+ br_read_unlock(vfsmount_lock);
+ }
return err;
}
retval = link_path_walk(name, nd);
if (nd->flags & LOOKUP_RCU) {
- /* RCU dangling. Cancel it. */
- if (!retval) {
- if (nameidata_drop_rcu_last(nd))
- retval = -ECHILD;
- } else {
- nd->flags &= ~LOOKUP_RCU;
- nd->root.mnt = NULL;
- rcu_read_unlock();
- br_read_unlock(vfsmount_lock);
- }
+ /* went all way through without dropping RCU */
+ BUG_ON(retval);
+ if (nameidata_drop_rcu_last(nd))
+ retval = -ECHILD;
}
if (!retval)