]> git.ipfire.org Git - thirdparty/squid.git/commit
Revised Slot management in Rock::DirMap.
authorAlex Rousskov <rousskov@measurement-factory.com>
Thu, 3 Feb 2011 23:41:32 +0000 (16:41 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Thu, 3 Feb 2011 23:41:32 +0000 (16:41 -0700)
commit395a85b49161fc365acb20ad67fb0787784fc7cd
treeb532e2142c881b8861cd3b6ea20f92d14bb39a69
parentdd7ac58bfa6d45ed7fe2310bcc7b6d17ffa19b4c
Revised Slot management in Rock::DirMap.

Old code was occasionally hitting a s.state == Slot::Writing assertion when
closing the writing state. Since I could not find a specific bug that would
lead to this, I decided to simplify state management by moving Slot locking
further away from the Slot state.

Two kinds of Slot locks are now supported: exclusive and shared. These are
implemented using simple atomic counters. To obtain the shared lock, the slot
must also be in a readable, not-marked-for-freeing state (this is where the
lock and the state still overlap). The code should eventually be polished
to use explicit creation-is-acquisition lock objects.

Old code could not cope with Slot deletion event arriving when the Slot was
being written to. We now mark the slot as in need of freeing, regardless of
the slot state. This may need more work to properly cleanup marked slots.

The old code used open/closeForWriting sequences for rebuilding the map from
disk. There were possibly some race conditions in that code. It is now
replaced with an dedicated, simpler, and optimized putAt() method.
src/fs/rock/RockDirMap.cc
src/fs/rock/RockDirMap.h
src/fs/rock/RockSwapDir.cc