main: use the rename version when setting opaque

so that it can be correctly set on the directory before renaming it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2020-01-17 16:09:43 +01:00
parent 632c56f4b9
commit d4a957dea9
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED

11
main.c
View File

@ -833,6 +833,15 @@ hide_node (struct ovl_data *lo, struct ovl_node *node, bool unlink_src)
bool needs_whiteout;
needs_whiteout = (node->last_layer != get_upper_layer (lo)) && (node->parent && node->parent->last_layer != get_upper_layer (lo));
if (!needs_whiteout && node_dirp (node))
{
ret = is_directory_opaque (get_upper_layer (lo), node->path);
if (ret < 0)
return ret;
if (ret)
needs_whiteout = true;
}
if (needs_whiteout)
{
/* If the atomic rename+mknod failed, then fallback into doing it in two steps. */
@ -2389,7 +2398,7 @@ create_directory (struct ovl_data *lo, int dirfd, const char *name, const struct
char wd_tmp_file_name[32];
bool need_rename;
need_rename = times || xattr_sfd >= 0 || uid != lo->uid || gid != lo->gid;
need_rename = set_opaque || times || xattr_sfd >= 0 || uid != lo->uid || gid != lo->gid;
if (!need_rename)
{
/* mkdir can be used directly without a temporary directory in the working directory. */