Skip to content

Commit f5f49f4

Browse files
theanalystesindril
authored andcommitted
MGM: use thread safe versions of common::LRU cache
Since these function calls are accessed by multiple threads with only the namespace read lock, make sure cache access is safe when EOS_MGM_LISTING_CACHE is set Fixes: EOS-6535 Signed-off-by: Abhishek Lekshmanan <abhishek.lekshmanan@cern.ch>
1 parent ae8e373 commit f5f49f4

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

mgm/XrdMgmOfsDirectory.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#endif
4646

4747

48-
eos::common::LRU::Cache<std::string, std::shared_ptr<XrdMgmOfsDirectory::listing_t>>
48+
eos::common::LRU::Cache<std::string, std::shared_ptr<XrdMgmOfsDirectory::listing_t>, std::mutex>
4949
XrdMgmOfsDirectory::dirCache(1024, 0);
5050

5151
//------------------------------------------------------------------------------

mgm/XrdMgmOfsDirectory.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public:
135135

136136
typedef std::set<std::string> listing_t;
137137

138-
static eos::common::LRU::Cache<std::string, std::shared_ptr<listing_t>>
138+
static eos::common::LRU::Cache<std::string, std::shared_ptr<listing_t>,std::mutex>
139139
dirCache;
140140

141141
private:

mgm/proc/user/Ls.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ ProcCommand::Ls()
6565
return cacheentry;
6666
}
6767
};
68-
static eos::common::LRU::Cache<std::string, struct result> dirCache;
68+
static eos::common::LRU::Cache<std::string, struct result, std::mutex> dirCache;
6969
static bool use_cache = (getenv("EOS_MGM_LISTING_CACHE") &&
7070
(dirCache.setMaxSize(atoi(getenv("EOS_MGM_LISTING_CACHE")))));
7171
std::ostringstream oss;

0 commit comments

Comments
 (0)