Merge pull request #164 from giuseppe/fix-160

main: force a dir reload after a move
This commit is contained in:
Daniel J Walsh 2020-01-08 12:20:29 -05:00 committed by GitHub
commit a0ba68151a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

26
main.c
View File

@ -1387,10 +1387,7 @@ load_dir (struct ovl_data *lo, struct ovl_node *n, struct ovl_layer *layer, char
ret = it->ds->file_exists (it, parent_whiteout_path);
if (ret < 0 && errno != ENOENT && errno != ENOTDIR)
{
it->ds->closedir (dp);
return NULL;
}
return NULL;
if (ret == 0)
break;
@ -1530,6 +1527,7 @@ load_dir (struct ovl_data *lo, struct ovl_node *n, struct ovl_layer *layer, char
n->last_layer = it;
stop_lookup = true;
}
it->ds->closedir (dp);
}
if (get_timeout (lo) > 0)
@ -1980,28 +1978,20 @@ create_missing_whiteouts (struct ovl_data *lo, struct ovl_node *node, const char
for (l = get_lower_layers (lo); l; l = l->next)
{
cleanup_dir DIR *dp = NULL;
cleanup_close int cleanup_fd = -1;
cleanup_fd = l->ds->openat (l, from, O_DIRECTORY, 0755);
if (cleanup_fd < 0)
dp = l->ds->opendir (l, from);
if (dp == NULL)
{
if (errno == ENOENT)
continue;
if (errno == ENOTDIR)
break;
if (errno == ENOENT)
continue;
return -1;
}
dp = fdopendir (cleanup_fd);
if (dp == NULL)
return -1;
else
{
struct dirent *dent;
cleanup_fd = -1; /* Now owned by dp. */
for (;;)
{
struct ovl_node key;
@ -2021,6 +2011,8 @@ create_missing_whiteouts (struct ovl_data *lo, struct ovl_node *node, const char
continue;
if (strcmp (dent->d_name, "..") == 0)
continue;
if (has_prefix (dent->d_name, ".wh."))
continue;
node_set_name (&key, (char *) dent->d_name);
@ -4176,6 +4168,8 @@ ovl_rename_direct (fuse_req_t req, fuse_ino_t parent, const char *name,
if (update_paths (node) < 0)
goto error;
node->loaded = 0;
ret = 0;
goto cleanup;