@@ -1526,6 +1526,7 @@ make_ovl_node (struct ovl_data *lo, const char *path, struct ovl_layer *layer, c
15261526 struct ovl_layer * it ;
15271527 cleanup_free char * npath = NULL ;
15281528 char whiteout_path [PATH_MAX ];
1529+ bool stop_lookup = false;
15291530
15301531 npath = strdup (ret -> path );
15311532 if (npath == NULL )
@@ -1536,13 +1537,16 @@ make_ovl_node (struct ovl_data *lo, const char *path, struct ovl_layer *layer, c
15361537 else
15371538 strconcat3 (whiteout_path , PATH_MAX , "/.wh." , name , NULL );
15381539
1539- for (it = layer ; it ; it = it -> next )
1540+ for (it = layer ; it && ! stop_lookup ; it = it -> next )
15401541 {
15411542 ssize_t s ;
15421543 cleanup_free char * val = NULL ;
15431544 cleanup_free char * origin = NULL ;
15441545 cleanup_close int fd = -1 ;
15451546
1547+ if (parent && parent -> last_layer == it )
1548+ stop_lookup = true;
1549+
15461550 if (dir_p )
15471551 {
15481552 int r ;
@@ -4982,42 +4986,6 @@ ovl_readlink (fuse_req_t req, fuse_ino_t ino)
49824986 fuse_reply_readlink (req , buf );
49834987}
49844988
4985- static int
4986- hide_all (struct ovl_data * lo , struct ovl_node * node )
4987- {
4988- struct ovl_node * * nodes ;
4989- size_t i , nodes_size ;
4990-
4991- node = reload_dir (lo , node );
4992- if (node == NULL )
4993- return -1 ;
4994-
4995- nodes_size = hash_get_n_entries (node -> children ) + 2 ;
4996- nodes = malloc (sizeof (struct ovl_node * ) * nodes_size );
4997- if (nodes == NULL )
4998- return -1 ;
4999-
5000- nodes_size = hash_get_entries (node -> children , (void * * ) nodes , nodes_size );
5001- for (i = 0 ; i < nodes_size ; i ++ )
5002- {
5003- struct ovl_node * it ;
5004- int ret ;
5005-
5006- it = nodes [i ];
5007- ret = create_whiteout (lo , node , it -> name , false, true);
5008- node_free (it );
5009-
5010- if (ret < 0 )
5011- {
5012- free (nodes );
5013- return ret ;
5014- }
5015- }
5016-
5017- free (nodes );
5018- return 0 ;
5019- }
5020-
50214989static void
50224990ovl_mknod (fuse_req_t req , fuse_ino_t parent , const char * name , mode_t mode , dev_t rdev )
50234991{
@@ -5239,21 +5207,9 @@ ovl_mkdir (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode)
52395207 return ;
52405208 }
52415209
5242- if (parent_upperdir_only )
5243- {
5244- node -> last_layer = pnode -> last_layer ;
5245- if (get_timeout (lo ) > 0 )
5246- node -> loaded = 1 ;
5247- }
5248- else
5249- {
5250- ret = hide_all (lo , node );
5251- if (ret < 0 )
5252- {
5253- fuse_reply_err (req , errno );
5254- return ;
5255- }
5256- }
5210+ node -> last_layer = get_upper_layer (lo );
5211+ if (get_timeout (lo ) > 0 )
5212+ node -> loaded = 1 ;
52575213
52585214 memset (& e , 0 , sizeof (e ));
52595215
0 commit comments