ovl: opaque xattr should overrule redirect xattr
Amir Goldstein
maintainerRFC PATCH 1/1 ovl: opaque xattr should overrule redirect xattr
opaque xattr and redirect xattr are not expected to be both set on the same directory, but in case they do, the opaque directive to stop merging lower dirs should overrule an absolute redirect directive to escape a pure directory.
This change comes with a cost of removing the optimiaztion for not checking opaque xattr on lookup in last parent layer. Instead, it adds an optimization for not checking opaque nor redirect xattr on lookup in overlay instance lowermost layer.
---
Vivek,
This is the other change I was talking about.
See if it can help you in any way.
I think this behavior change makes sense, but behavior on this case is undefined anyway.
Thanks,
Amir.
fs/overlayfs/namei.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/overlayfs/namei.c +5 -3
@@ -256,7 +256,9 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d, goto out; } d->is_dir = true; -if (!d->last &&ovl_is_opaquedir (this)) { +if (d->last) + goto out; +if (ovl_is_opaquedir (this)) { d->stop = d->opaque = true; goto out; }
@@ -823,7 +825,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry, .is_dir = false, .opaque = false, .stop = false, - .last = !poe->numlower, + .last = false, .redirect = NULL, };
@@ -881,7 +883,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,for (i =0 ; !d.stop && i < poe->numlower; i++) {struct ovl_path lower = poe->lowerstack[i]; - d.last = i == poe->numlower -1 ; + d.last = lower.layer->idx == roe->numlower; err =ovl_lookup_layer (lower.dentry, &d, &this);if (err) goto out_put;
Signature · 1 line
2.7.4
Miklos Szeredi
maintainerQuoted 9 lines · Amir Goldstein
opaque xattr and redirect xattr are not expected to be both set on the same directory, but in case they do, the opaque directive to stop merging lower dirs should overrule an absolute redirect directive to escape a pure directory.
This change comes with a cost of removing the optimiaztion for not checking opaque xattr on lookup in last parent layer. Instead, it adds an optimization for not checking opaque nor redirect xattr on lookup in overlay instance lowermost layer.
AFAICS this one's obsoleted by Vivek's "ovl: Set d->last properly during lookup", so using that one.
Thanks,
Miklos
Amir Goldstein
maintainerQuoted 6 lines · Miklos Szeredi
Quoted 5 lines · Amir Goldstein
opaque xattr and redirect xattr are not expected to be both set on the same directory, but in case they do, the opaque directive to stop merging lower dirs should overrule an absolute redirect directive to escape a pure directory.
Quoted 8 lines
Quoted 4 lines
This change comes with a cost of removing the optimiaztion for not checking opaque xattr on lookup in last parent layer. Instead, it adds an optimization for not checking opaque nor redirect xattr on lookup in overlay instance lowermost layer.
AFAICS this one's obsoleted by Vivek's "ovl: Set
d->lastproperly during lookup", so using that one.
Correct.
Thanks,
Amir.