mirror of
https://github.com/ceph/ceph
synced 2025-01-19 01:21:49 +00:00
rgw: add missing cache locking
this was overlooked when switch to the multithreaded configuration
This commit is contained in:
parent
0b216bdc8c
commit
f3396bdc50
@ -7,6 +7,8 @@ using namespace std;
|
||||
|
||||
int ObjectCache::get(string& name, ObjectCacheInfo& info, uint32_t mask)
|
||||
{
|
||||
Mutex::Locker l(lock);
|
||||
|
||||
map<string, ObjectCacheEntry>::iterator iter = cache_map.find(name);
|
||||
if (iter == cache_map.end()) {
|
||||
RGW_LOG(10) << "cache get: name=" << name << " : miss" << dendl;
|
||||
@ -29,6 +31,8 @@ int ObjectCache::get(string& name, ObjectCacheInfo& info, uint32_t mask)
|
||||
|
||||
void ObjectCache::put(string& name, ObjectCacheInfo& info)
|
||||
{
|
||||
Mutex::Locker l(lock);
|
||||
|
||||
RGW_LOG(10) << "cache put: name=" << name << dendl;
|
||||
map<string, ObjectCacheEntry>::iterator iter = cache_map.find(name);
|
||||
if (iter == cache_map.end()) {
|
||||
@ -67,6 +71,8 @@ void ObjectCache::put(string& name, ObjectCacheInfo& info)
|
||||
|
||||
void ObjectCache::remove(string& name)
|
||||
{
|
||||
Mutex::Locker l(lock);
|
||||
|
||||
map<string, ObjectCacheEntry>::iterator iter = cache_map.find(name);
|
||||
if (iter == cache_map.end())
|
||||
return;
|
||||
|
@ -104,11 +104,12 @@ struct ObjectCacheEntry {
|
||||
class ObjectCache {
|
||||
std::map<string, ObjectCacheEntry> cache_map;
|
||||
std::list<string> lru;
|
||||
Mutex lock;
|
||||
|
||||
void touch_lru(string& name, std::list<string>::iterator& lru_iter);
|
||||
void remove_lru(string& name, std::list<string>::iterator& lru_iter);
|
||||
public:
|
||||
ObjectCache() { }
|
||||
ObjectCache() : lock("ObjectCache") { }
|
||||
int get(std::string& name, ObjectCacheInfo& bl, uint32_t mask);
|
||||
void put(std::string& name, ObjectCacheInfo& bl);
|
||||
void remove(std::string& name);
|
||||
|
Loading…
Reference in New Issue
Block a user