anchor.diff:                                  {busy, RemainingTime};
                               %% The old lease is expired. Delete it and insert the new one
                               false ->
  -                                mnesia:delete({lease, Path}),
  -                                p_write_row(KeyId, Path, Public, Secret)
  +                                mnesia:delete({lease, {Repo, ConflictingPath}}),
  +                                p_write_row(KeyId, Repo, Subpath, Public, Secret)
                           end;
                       %% No overlapping paths were found; just insert the new entry
                       _ ->
  -                        p_write_row(KeyId, Path, Public, Secret)
  +                        p_write_row(KeyId, Repo, Subpath, Public, Secret)
                   end
           end,
       {atomic, Result} = mnesia:sync_transaction(T),
  
positive.code:     Result.
  
  
  -spec p_write_row(KeyId, Path, Public, Secret) -> ok
                                                       when KeyId :: binary(),
                                                            Path :: binary(),
                                                            Public :: binary(),
                                                            Secret :: binary().
  p_write_row(KeyId, Path, Public, Secret) ->
      mnesia:write(#lease{path = Path,
                          key_id = KeyId,
                          public = Public,
                          secret = Secret,
  
negative.code: p_new_lease(KeyId, Path, Public, Secret, _State) ->
      {ok, MaxLeaseTime} = application:get_env(cvmfs_gateway, max_lease_time),
  
      {Repo, Subpath} = cvmfs_path_util:split_repo_path(Path),
  
      %% Match statement that selects all rows with a given repo,
      %% returning a list of {Path, Time} pairs
      MS = ets:fun2ms(fun(#lease{path = {R, _}} = Lease) when R =:= Repo ->
                              Lease
                      end),
  
      AreOverlapping = fun(#lease{path = {_, P}}) ->
                               cvmfs_path_util:are_overlapping(P, Subpath)
                       end,
  
      T = fun() ->
  