diff options
-rw-r--r-- | fs/overlayfs/namei.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c index 1687a770ff39..f9640d27ddab 100644 --- a/fs/overlayfs/namei.c +++ b/fs/overlayfs/namei.c @@ -902,15 +902,6 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, } /* - * Do not store intermediate metacopy dentries in chain, - * except top most lower metacopy dentry - */ - if (d.metacopy && ctr) { - dput(this); - continue; - } - - /* * If no origin fh is stored in upper of a merge dir, store fh * of lower dir and set upper parent "impure". */ @@ -944,9 +935,20 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, origin = this; } - stack[ctr].dentry = this; - stack[ctr].layer = lower.layer; - ctr++; + if (d.metacopy && ctr) { + /* + * Do not store intermediate metacopy dentries in + * lower chain, except top most lower metacopy dentry. + * Continue the loop so that if there is an absolute + * redirect on this dentry, poe can be reset to roe. + */ + dput(this); + this = NULL; + } else { + stack[ctr].dentry = this; + stack[ctr].layer = lower.layer; + ctr++; + } /* * Following redirects can have security consequences: it's like |