unsigned seq;
while (1) {
- if (path_equal(&nd->path, &nd->root)) {
- if (unlikely(nd->flags & LOOKUP_BENEATH))
- return -ECHILD;
+ if (path_equal(&nd->path, &nd->root))
break;
- }
if (nd->path.dentry != nd->path.mnt->mnt_root) {
struct dentry *old = nd->path.dentry;
nd->seq = seq;
}
}
- if (likely(parent)) {
+ if (unlikely(!parent)) {
+ if (unlikely(nd->flags & LOOKUP_BENEATH))
+ return -ECHILD;
+ } else {
nd->path.dentry = parent;
nd->seq = seq;
}
{
struct dentry *parent = NULL;
while (1) {
- if (path_equal(&nd->path, &nd->root)) {
- if (unlikely(nd->flags & LOOKUP_BENEATH))
- return -EXDEV;
+ if (path_equal(&nd->path, &nd->root))
break;
- }
if (nd->path.dentry != nd->path.mnt->mnt_root) {
/* rare case of legitimate dget_parent()... */
parent = dget_parent(nd->path.dentry);
if (unlikely(nd->flags & LOOKUP_NO_XDEV))
return -EXDEV;
}
- if (likely(parent)) {
+ if (unlikely(!parent)) {
+ if (unlikely(nd->flags & LOOKUP_BENEATH))
+ return -EXDEV;
+ } else {
dput(nd->path.dentry);
nd->path.dentry = parent;
}