fuse-overlayfs: fix lookup with multiple layers

when looking up multiple layers and we have already found a file, do
not check if whiteouts are present in lower layers.  The lookup in the
lower layers is needed only to correctly propagate the inode number.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1686889

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2019-03-08 18:09:04 +01:00
parent ea72572364
commit 44d23bc07e
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED

16
main.c
View File

@ -1220,6 +1220,9 @@ do_lookup_file (struct ovl_data *lo, fuse_ino_t parent, const char *name)
if (errno == ENOENT)
{
if (node)
continue;
ret = asprintf (&whpath, "%s/.wh.%s", pnode->path, name);
if (ret < 0)
return NULL;
@ -1239,31 +1242,18 @@ do_lookup_file (struct ovl_data *lo, fuse_ino_t parent, const char *name)
}
continue;
}
if (node)
node_free (node);
errno = saved_errno;
return NULL;
}
/* If we already know the node, simply update the ino. */
if (node)
{
if (node->whiteout && it == upper_layer)
{
hash_delete (pnode->children, node);
node_free (node);
node = NULL;
}
else
{
node->ino = st.st_ino;
if (it->low)
node->present_lowerdir = 1;
continue;
}
}
if (whpath == NULL)
{