Merge pull request #309 from sipsma/whiteout-in-opaque

Don't create whiteout files in opaque dirs.
This commit is contained in:
Giuseppe Scrivano 2021-07-08 16:17:29 +02:00 committed by GitHub
commit c45d315d19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 0 deletions

4
main.c
View File

@ -1065,6 +1065,10 @@ hide_node (struct ovl_data *lo, struct ovl_node *node, bool unlink_src)
needs_whiteout = true;
}
// if the parent directory is opaque, there's no need to put a whiteout in it.
if (node->parent != NULL)
needs_whiteout = needs_whiteout && (is_directory_opaque(get_upper_layer(lo), node->parent->path) < 1);
if (needs_whiteout)
{
/* If the atomic rename+mknod failed, then fallback into doing it in two steps. */

View File

@ -231,3 +231,20 @@ if test -e upperdir/test/.wh.a.txt; then
echo "whiteout file still exists" >&2
exit 1
fi
# https://github.com/containers/fuse-overlayfs/issues/306
umount -l merged
rm -rf lower upper workdir merged
mkdir lower upper workdir merged
mkdir -p lower/a/b
fuse-overlayfs -o lowerdir=lower,upperdir=upper,workdir=workdir merged
rm -rf merged/a
mkdir -p merged/a/b
rm -rf merged/a/b
test \! -e upper/a/b
umount merged