anchor.diff:          false ->
               ok
       end.
  +
  +
  +%% @private
  +-spec await_caches_clearing(node(), od_space:id(), od_user:id(), map()) -> ok.
  +await_caches_clearing(Node, SpaceId, UserId, ExtraData) ->
  +    Attempts = 30,
  +    Interval = 100,
  +    ProtectionFlagsCache = binary_to_atom(<<"file_protection_flags_cache_", SpaceId/binary>>, utf8),
  +
  +    AreProtectionFlagsCached = fun(FileUuid) ->
  +        case rpc:call(Node, bounded_cache, get, [ProtectionFlagsCache, FileUuid]) of
  +            {ok, _} -> true;
  +            ?ERROR_NOT_FOUND -> false
  +        end
  +    end,
  +
  +    IsPermEntryCached = fun(Entry) ->
  +        case rpc:call(Node, permissions_cache, check_permission, [Entry]) of
  +            {ok, _} -> true;
  +            calculate -> false
  +        end
  +    end,
  +
  +    lists:foreach(fun
  +        ({guid, FileGuid}) ->
  +            FileUuid = file_id:guid_to_uuid(FileGuid),
  +            ?assertMatch(false, AreProtectionFlagsCached(FileUuid), Attempts, Interval),
  +            ?assertMatch(false, IsPermEntryCached({{user_perms_matrix, UserId, FileGuid}}), Attempts, Interval);
  +        (_) ->
  +            ok
  +    end, maps:values(ExtraData)).
   
   
   %%%===================================================================
  
positive.code:     owner_user = FileOwner,
      space_user = SpaceUser,
      requires_traverse_ancestors = RequiresTraverseAncestors,
      operation = Operation,
      files = Files
  } = TestSpec, Config) ->
  
negative.code:             ok = lfm_proxy:update_protection_flags(
                  Node, ?ROOT_SESS_ID, ScenarioRootDirKey, ProtectionFlagsToSet, ?no_flags_mask
              ),
              await_caches_clearing(Node, SpaceId, Executioner, ExtraData),
              ?assertMatch({error, ?EPERM}, Operation(ExecutionerSessId, ScenarioRootDirPath, ExtraData)),
  
              % And should succeed without it
              ok = lfm_proxy:update_protection_flags(
                  Node, ?ROOT_SESS_ID, ScenarioRootDirKey, ?no_flags_mask, ProtectionFlagsToSet
              ),
              await_caches_clearing(Node, SpaceId, Executioner, ExtraData),
              ?assertMatch(ok, Operation(ExecutionerSessId, ScenarioRootDirPath, ExtraData)),
  
              run_final_ownership_check(#scenario_ctx{
  