forked from memcached/memcached
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clean do_item_get logic a bit. fix race.
the race here is absolutely insane: - do_item_get and do_item_alloc call at the same time, against different items - do_item_get wins cache_lock lock race, returns item for internal testing - do_item_alloc runs next, pulls item off of tail of a slab class which is the same item as do_item_get just got - do_item_alloc sees refcount == 0 since do_item_get incrs it at the bottom, and starts messing with the item - do_item_get runs its tests and maybe even refcount++'s and returns the item - evil shit happens. This race is much more likely to hit during the slab reallocation work, so I'm fixing it even though it's almost impossible to cause. Also cleaned up the logic so it's not testing the item for NULL more than once. Far fewer branches now, though I did not examine gcc's output to see if it is optimized differently.
- Loading branch information
Showing
1 changed file
with
28 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters