In this one, if a read, then a delete happened on an object being flushed
by makeSpace(), it would leave the toBeDeleted struct with an invalid
list iterator.
unreasonably small value. Had to make a compromise to avoid a deadlock
though. read/write/append/truncate will now be able to exceed the cache size
limit temporarily. The cache will be reconciled at the end of the respective
operation.
Ex, given a cache of 100MB, and a read() of 500MB, all 500MB
of data being read will stay in the cache until it is read, then
400MB of it will be evicted. Same on the write side.
Now, something that grabs the sync or cache locks should never block
while holding the lock. Need to review the code to make sure of that.
Also made the recursive mutexes non-recursive again.
reference to a shared pointer. A deref of the shared ptr could
trigger the dtor of the object while threads are waiting. Fixed that
by properly copying the shared ptr.