Page MenuHomePhabricator

tags: take lock instead of wlock before writing hgtagsfnodes1 cache

Authored by pulkit on Sep 8 2020, 10:12 AM.



This cache is shared across stores and hence we should take store lock before
writing to it. Otherwise there will be race where one share with wlock is
writing to this cache and other share with wlock is trying to read it

Diff Detail

rHG Mercurial
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit created this revision.Sep 8 2020, 10:12 AM
pulkit planned changes to this revision.Sep 10 2020, 7:09 AM
This revision was not accepted when it landed; it landed in state Changes Planned.
This revision was automatically updated to reflect the committed changes.

This change may break compatibility with older clients. As written, if an old client and modern client write the tags cache file, they will obtain different locks and race to write the tags cache. If we want backwards compatibility, we need to take the store lock in addition to the working directory lock.