Bug 1614706 - ThreadSanitizer: data race [@ Release] vs. [@ CloseWithStatusLocked] in CacheFileInputStream r=mayhemer

Acquiring the lock is moved from CacheFile::RemoveInput() to CacheFileInputStream::Release(). This fixes the data race and is consistent with CacheFile::RemoveOutput() which is also called under the lock.

Differential Revision: https://phabricator.services.mozilla.com/D62504

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michal Novotny 2020-02-12 14:45:36 +00:00
Родитель 0bcf2288ef
Коммит 32b5d4c391
2 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -2065,7 +2065,7 @@ static uint32_t StatusToTelemetryEnum(nsresult aStatus) {
}
void CacheFile::RemoveInput(CacheFileInputStream* aInput, nsresult aStatus) {
CacheFileAutoLock lock(this);
AssertOwnsLock();
LOG(("CacheFile::RemoveInput() [this=%p, input=%p, status=0x%08" PRIx32 "]",
this, aInput, static_cast<uint32_t>(aStatus)));

Просмотреть файл

@ -27,6 +27,7 @@ CacheFileInputStream::Release() {
}
if (count == 1) {
CacheFileAutoLock lock(mFile);
mFile->RemoveInput(this, mStatus);
}