memcached/memcached — pull request #74 by zwChan (2014-07-01 12:03:48+00:00)
Title: fix issue#370. check refcount again after the item unlinked.

In the function do_item_alloc, it will hold the search item without got a lock when hash expanding. With the cache_lock holding, it is safe to hold a item without item_lock or global_lock, unless you try to reset the refcount.
after unlinked, the item is impossible to fetch by other threads, so it is safe to check the refcount again.
refcount == 1 means that i m the only guy holding the item, and now it is safe to reset the refcount.
I try to fix it with lowest risk, and it is simple enough to understand. the do_item_alloc is complex enough..