mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-08 14:52:31 -04:00
main: skip ENAMETOOLONG for whiteouts lookup
adding the .wh. prefix could cause the lookup to cross the f_namemax limit and fail the lookup with ENAMETOOLONG. If the lookup fails with ENAMETOOLONG then the whiteout file doesn't exist. Closes: https://github.com/containers/fuse-overlayfs/issues/236 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
421c64db78
commit
d34833dfb3
10
main.c
10
main.c
@ -1365,7 +1365,7 @@ make_ovl_node (struct ovl_data *lo, const char *path, struct ovl_layer *layer, c
|
||||
int r;
|
||||
|
||||
r = it->ds->file_exists (it, whiteout_path);
|
||||
if (r < 0 && errno != ENOENT && errno != ENOTDIR)
|
||||
if (r < 0 && errno != ENOENT && errno != ENOTDIR && errno != ENAMETOOLONG)
|
||||
return NULL;
|
||||
|
||||
if (r == 0)
|
||||
@ -1546,7 +1546,7 @@ load_dir (struct ovl_data *lo, struct ovl_node *n, struct ovl_layer *layer, char
|
||||
stop_lookup = true;
|
||||
|
||||
ret = it->ds->file_exists (it, parent_whiteout_path);
|
||||
if (ret < 0 && errno != ENOENT && errno != ENOTDIR)
|
||||
if (ret < 0 && errno != ENOENT && errno != ENOTDIR && errno != ENAMETOOLONG)
|
||||
return NULL;
|
||||
|
||||
if (ret == 0)
|
||||
@ -1600,7 +1600,7 @@ load_dir (struct ovl_data *lo, struct ovl_node *n, struct ovl_layer *layer, char
|
||||
strconcat3 (node_path, PATH_MAX, n->path, "/", dent->d_name);
|
||||
|
||||
ret = it->ds->file_exists (it, whiteout_path);
|
||||
if (ret < 0 && errno != ENOENT && errno != ENOTDIR)
|
||||
if (ret < 0 && errno != ENOENT && errno != ENOTDIR && errno != ENAMETOOLONG)
|
||||
{
|
||||
it->ds->closedir (dp);
|
||||
return NULL;
|
||||
@ -1908,7 +1908,7 @@ do_lookup_file (struct ovl_data *lo, fuse_ino_t parent, const char *name)
|
||||
strconcat3 (whpath, PATH_MAX, pnode->path, "/.wh.", name);
|
||||
|
||||
ret = it->ds->file_exists (it, whpath);
|
||||
if (ret < 0 && errno != ENOENT && errno != ENOTDIR)
|
||||
if (ret < 0 && errno != ENOENT && errno != ENOTDIR && errno != ENAMETOOLONG)
|
||||
return NULL;
|
||||
if (ret == 0)
|
||||
{
|
||||
@ -1937,7 +1937,7 @@ do_lookup_file (struct ovl_data *lo, fuse_ino_t parent, const char *name)
|
||||
|
||||
strconcat3 (whpath, PATH_MAX, pnode->path, "/.wh.", name);
|
||||
ret = it->ds->file_exists (it, whpath);
|
||||
if (ret < 0 && errno != ENOENT && errno != ENOTDIR)
|
||||
if (ret < 0 && errno != ENOENT && errno != ENOTDIR && errno != ENAMETOOLONG)
|
||||
return NULL;
|
||||
if (ret == 0)
|
||||
node = make_whiteout_node (path, name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user