Closed
Bug 1292547
Opened 8 years ago
Closed 8 years ago
Kill() CacheFile when there is only a writer reference to its CacheEntry
Categories
(Core :: Networking: Cache, defect)
Core
Networking: Cache
Tracking
()
RESOLVED
FIXED
mozilla51
Tracking | Status | |
---|---|---|
firefox51 | --- | fixed |
People
(Reporter: mayhemer, Assigned: mayhemer)
Details
(Whiteboard: [necko-active])
Attachments
(1 file)
2.21 KB,
patch
|
michal
:
review+
|
Details | Diff | Splinter Review |
I think we can safely bypass any IO operation on a doomed cache file when there is only one last consumer of the cache entry (most common case) which is also the writer. There is no way to reach the data at the moment, so we can throw it easily away.
Assignee | ||
Comment 1•8 years ago
|
||
The patch simply call mFile->Kill() also where there is only one last reference from the CacheEntry's writer. Note that a doomed cache entry can never be added a reference from outside again.
Attachment #8778395 -
Flags: review?(michal.novotny)
Assignee | ||
Updated•8 years ago
|
Whiteboard: [necko-active]
Assignee | ||
Comment 2•8 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=f03e9ce17e6f
Comment 3•8 years ago
|
||
Comment on attachment 8778395 [details] [diff] [review] v1 Review of attachment 8778395 [details] [diff] [review]: ----------------------------------------------------------------- ::: netwerk/cache2/CacheEntry.cpp @@ +925,5 @@ > > + if (IsDoomed() && NS_SUCCEEDED(mFileStatus) && > + // Note: mHandlesCount is dropped before this method is called > + (mHandlesCount == 0 || > + (mHandlesCount == 1 && mWriter && mWriter != aHandle)) If there is a single handle and mWriter is non-null, then shouldn't be always mWriter == aHandle?
Attachment #8778395 -
Flags: review?(michal.novotny)
Updated•8 years ago
|
Flags: needinfo?(honzab.moz)
Assignee | ||
Comment 4•8 years ago
|
||
(In reply to Michal Novotny (:michal) from comment #3) > Comment on attachment 8778395 [details] [diff] [review] > v1 > > Review of attachment 8778395 [details] [diff] [review]: > ----------------------------------------------------------------- > > ::: netwerk/cache2/CacheEntry.cpp > @@ +925,5 @@ > > > > + if (IsDoomed() && NS_SUCCEEDED(mFileStatus) && > > + // Note: mHandlesCount is dropped before this method is called > > + (mHandlesCount == 0 || > > + (mHandlesCount == 1 && mWriter && mWriter != aHandle)) > > If there is a single handle and mWriter is non-null, then shouldn't be > always mWriter == aHandle? No. The sequencing is this: - there is a writer, mWriter != null - there are two handles, one writer, one non-writer - the non-writer releases its reference: - CacheEntryHandle::~CacheEntryHandle: the non-writer goes away - mEntry->ReleaseHandleRef(): makes mHandlesCount == 1 - mEntry->OnHandleClosed(aHandle != mWriter) -> condition passes, because the last reference then must be from the writer! I've added the "// Note: mHandlesCount is dropped before this method is called" comment to make this more obvious ;)
Flags: needinfo?(honzab.moz)
Assignee | ||
Updated•8 years ago
|
Attachment #8778395 -
Flags: review?(michal.novotny)
Updated•8 years ago
|
Attachment #8778395 -
Flags: review?(michal.novotny) → review+
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Pushed by cbook@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/d7440cbd54b9 Kill() doomed CacheFile when only refered by the writer, r=michal
Keywords: checkin-needed
Comment 6•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d7440cbd54b9
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in
before you can comment on or make changes to this bug.
Description
•