mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-14 17:56:11 -04:00
lookup: check for a .wh. file in the same layer
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
4007f8b65f
commit
55b068e823
22
main.c
22
main.c
@ -1129,7 +1129,7 @@ do_lookup_file (struct ovl_data *lo, fuse_ino_t parent, const char *name)
|
|||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
char whpath[PATH_MAX];
|
char whpath[PATH_MAX];
|
||||||
struct ovl_layer *it;
|
struct ovl_layer *it;
|
||||||
struct stat st;
|
struct stat st, tmp_st;
|
||||||
struct ovl_layer *upper_layer = get_upper_layer (lo);
|
struct ovl_layer *upper_layer = get_upper_layer (lo);
|
||||||
|
|
||||||
for (it = lo->layers; it; it = it->next)
|
for (it = lo->layers; it; it = it->next)
|
||||||
@ -1143,7 +1143,23 @@ do_lookup_file (struct ovl_data *lo, fuse_ino_t parent, const char *name)
|
|||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
|
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
|
{
|
||||||
|
sprintf (whpath, "%s/.wh.%s", pnode->path, name);
|
||||||
|
ret = TEMP_FAILURE_RETRY (fstatat (it->fd, whpath, &tmp_st, AT_SYMLINK_NOFOLLOW));
|
||||||
|
if (ret < 0 && errno != ENOENT)
|
||||||
|
return NULL;
|
||||||
|
if (ret == 0)
|
||||||
|
{
|
||||||
|
node = make_whiteout_node (path, name);
|
||||||
|
if (node == NULL)
|
||||||
|
{
|
||||||
|
errno = ENOMEM;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
goto insert_node;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (node)
|
if (node)
|
||||||
node_free (node);
|
node_free (node);
|
||||||
@ -1171,7 +1187,7 @@ do_lookup_file (struct ovl_data *lo, fuse_ino_t parent, const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sprintf (whpath, "%s/.wh.%s", pnode->path, name);
|
sprintf (whpath, "%s/.wh.%s", pnode->path, name);
|
||||||
ret = TEMP_FAILURE_RETRY (fstatat (it->fd, whpath, &st, AT_SYMLINK_NOFOLLOW));
|
ret = TEMP_FAILURE_RETRY (fstatat (it->fd, whpath, &tmp_st, AT_SYMLINK_NOFOLLOW));
|
||||||
if (ret < 0 && errno != ENOENT)
|
if (ret < 0 && errno != ENOENT)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
@ -1201,7 +1217,7 @@ do_lookup_file (struct ovl_data *lo, fuse_ino_t parent, const char *name)
|
|||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
node->last_layer = it;
|
node->last_layer = it;
|
||||||
}
|
}
|
||||||
|
insert_node:
|
||||||
if (insert_node (pnode, node, false) == NULL)
|
if (insert_node (pnode, node, false) == NULL)
|
||||||
{
|
{
|
||||||
node_free (node);
|
node_free (node);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user