@@ -1485,6 +1485,9 @@ make_ovl_node (struct ovl_data *lo, const char *path, struct ovl_layer *layer, c
1485
1485
int r ;
1486
1486
1487
1487
r = it -> ds -> file_exists (it , whiteout_path );
1488
+ if (r < 0 && errno == EACCES )
1489
+ break ;
1490
+
1488
1491
if (r < 0 && errno != ENOENT && errno != ENOTDIR && errno != ENAMETOOLONG )
1489
1492
return NULL ;
1490
1493
@@ -1659,8 +1662,9 @@ load_dir (struct ovl_data *lo, struct ovl_node *n, struct ovl_layer *layer, char
1659
1662
1660
1663
for (it = lo -> layers ; it && !stop_lookup ; it = it -> next )
1661
1664
{
1662
- int ret ;
1665
+ struct stat st ;
1663
1666
DIR * dp = NULL ;
1667
+ int ret ;
1664
1668
1665
1669
if (n -> last_layer == it )
1666
1670
stop_lookup = true;
@@ -1672,6 +1676,17 @@ load_dir (struct ovl_data *lo, struct ovl_node *n, struct ovl_layer *layer, char
1672
1676
if (ret == 0 )
1673
1677
break ;
1674
1678
1679
+ ret = it -> ds -> statat (it , path , & st , AT_SYMLINK_NOFOLLOW , STATX_TYPE );
1680
+ if (ret < 0 )
1681
+ {
1682
+ if (errno == ENOENT || errno == ENOTDIR || errno == ENAMETOOLONG )
1683
+ continue ;
1684
+ return NULL ;
1685
+ }
1686
+ /* not a directory, stop lookup in lower layers. */
1687
+ if ((st .st_mode & S_IFMT ) != S_IFDIR )
1688
+ break ;
1689
+
1675
1690
dp = it -> ds -> opendir (it , path );
1676
1691
if (dp == NULL )
1677
1692
continue ;
@@ -1720,6 +1735,8 @@ load_dir (struct ovl_data *lo, struct ovl_node *n, struct ovl_layer *layer, char
1720
1735
strconcat3 (node_path , PATH_MAX , n -> path , "/" , dent -> d_name );
1721
1736
1722
1737
ret = it -> ds -> file_exists (it , whiteout_path );
1738
+ if (ret < 0 && errno == EACCES )
1739
+ continue ;
1723
1740
if (ret < 0 && errno != ENOENT && errno != ENOTDIR && errno != ENAMETOOLONG )
1724
1741
{
1725
1742
it -> ds -> closedir (dp );
@@ -2020,7 +2037,7 @@ do_lookup_file (struct ovl_data *lo, fuse_ino_t parent, const char *name)
2020
2037
{
2021
2038
int saved_errno = errno ;
2022
2039
2023
- if (errno == ENOENT || errno == ENOTDIR )
2040
+ if (errno == ENOENT || errno == ENOTDIR || errno == EACCES )
2024
2041
{
2025
2042
if (node )
2026
2043
continue ;
0 commit comments