On Sun, 21 Jan 2024 at 16:05, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > > An opaque directory cannot have xwhiteouts, so instead of marking an > xwhiteouts directory with a new xattr, overload overlay.opaque xattr > for marking both opaque dir ('y') and xwhiteouts dir ('x'). > > This is more efficient as the overlay.opaque xattr is checked during > lookup of directory anyway. > > This also prevents unnecessary checking the xattr when reading a > directory without xwhiteouts, i.e. most of the time. > > Note that the xwhiteouts marker is not checked on the upper layer and > on the last layer in lowerstack, where xwhiteouts are not expected. > > Fixes: bc8df7a3dc03 ("ovl: Add an alternative type of whiteout") > Cc: <stable@xxxxxxxxxxxxxxx> # v6.7 > Signed-off-by: Amir Goldstein <amir73il@xxxxxxxxx> > --- > > Miklos, > > Alex has reported a problem with your suggested approach of requiring > xwhiteouts xattr on layers root dir [1]. > > Following counter proposal, amortizes the cost of checking opaque xattr > on directories during lookup to also check for xwhiteouts. Concept looks good overall. overlayfs.rst needs updating with the new format. BTW the nesting format should also be documented, but that's a separate patch. > @@ -292,7 +292,11 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d, > if (d->last) > goto out; > > - if (ovl_is_opaquedir(OVL_FS(d->sb), &path)) { > + /* overlay.opaque=x means xwhiteouts directory */ > + val = ovl_get_opaquedir_val(ofs, &path); > + if (last_element && !is_upper && val == 'x') { > + d->xwhiteouts = true; Maybe I'm missing something, but can't we set the flag on the layer? Thanks, Miklos