main: load_dir updates the node last layer

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2019-07-23 08:48:10 +02:00
parent d99d8684c0
commit cbf7881f01
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED

8
main.c
View File

@ -1149,7 +1149,10 @@ make_ovl_node (const char *path, struct ovl_layer *layer, const char *name, ino_
continue; continue;
if (fstat (fd, &st) == 0) if (fstat (fd, &st) == 0)
ret->ino = st.st_ino; {
ret->ino = st.st_ino;
ret->last_layer = it;
}
s = safe_read_xattr (&val, fd, PRIVILEGED_ORIGIN_XATTR, PATH_MAX); s = safe_read_xattr (&val, fd, PRIVILEGED_ORIGIN_XATTR, PATH_MAX);
if (s > 0) if (s > 0)
@ -1322,6 +1325,7 @@ load_dir (struct ovl_data *lo, struct ovl_node *n, struct ovl_layer *layer, char
child = hash_lookup (n->children, &key); child = hash_lookup (n->children, &key);
if (child) if (child)
{ {
child->last_layer = it;
if (child->whiteout && it == upper_layer) if (child->whiteout && it == upper_layer)
{ {
hash_delete (n->children, child); hash_delete (n->children, child);
@ -1386,13 +1390,13 @@ load_dir (struct ovl_data *lo, struct ovl_node *n, struct ovl_layer *layer, char
} }
else else
{ {
child = make_ovl_node (node_path, it, dent->d_name, 0, dirp, n, lo->fast_ino_check); child = make_ovl_node (node_path, it, dent->d_name, 0, dirp, n, lo->fast_ino_check);
if (child == NULL) if (child == NULL)
{ {
errno = ENOMEM; errno = ENOMEM;
return NULL; return NULL;
} }
child->last_layer = it;
} }
} }