Commit c84510bd authored by Georgios Bitzes's avatar Georgios Bitzes Committed by Elvin Sindrilaru

COMMON: Fix data-race (write under read lock) in FileSystem.hh

WARNING: ThreadSanitizer: data race (pid=11483) Write of size 8 at 0x7b4c000036b0 by thread T105 (mutexes: read M2044, read M2202): #0 eos::common::FileSystem::SetLongLong(char const*, long long, bool) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/common/FileSystem.hh:390 (libXrdEosMgm.so+0x00000027d722) #1 eos::mgm::Messaging::Update(XrdAdvisoryMqMessage*) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/mgm/Messaging.cc:163 (libXrdEosMgm.so+0x00000027d722) #2 eos::mgm::Messaging::Process(XrdMqMessage*) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/mgm/Messaging.cc:220 (libXrdEosMgm.so+0x00000027bfab) #3 eos::mgm::Messaging::Listen() /afs/cern.ch/user/g/gbitzes/dev/eos-dev/mgm/Messaging.cc:187 (libXrdEosMgm.so+0x00000027ab4e) #4 XrdMqMessaging::Start(void*) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/mq/XrdMqMessaging.cc:35 (libXrdMqClient.so.4+0x0000000272ac) #5 XrdSysThread_Xeq <null> (libXrdUtils.so.2+0x00000002d75e) #6 <null> <null> (libtsan.so.0+0x0000000257eb) Previous write of size 8 at 0x7b4c000036b0 by main thread (mutexes: read M2044, read M2202): #0 eos::common::FileSystem::SetString(char const*, char const*, bool) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/common/FileSystem.hh:358 (libXrdEosMgm.so+0x0000005421e3) #1 eos::mgm::FileSystem::SetConfigStatus(int) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/mgm/FileSystem.cc:166 (libXrdEosMgm.so+0x0000005421e3) #2 eos::mgm::FsView::ReapplyConfigStatus() /afs/cern.ch/user/g/gbitzes/dev/eos-dev/mgm/FsView.cc:4153 (libXrdEosMgm.so+0x00000041b7bb) #3 eos::mgm::Master::Activate(XrdOucString&, XrdOucString&, int) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/mgm/Master.cc:1145 (libXrdEosMgm.so+0x0000006940d8) #4 eos::mgm::Master::ApplyMasterConfig(XrdOucString&, XrdOucString&, eos::mgm::Master::Transition::Type) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/mgm/Master.cc:1056 (libXrdEosMgm.so+0x00000069483b) #5 XrdMgmOfs::Configure(XrdSysError&) /afs/cern.ch/user/g/gbitzes/dev/eos-dev/mgm/XrdMgmOfsConfigure.cc:1899 (libXrdEosMgm.so+0x000000455222) #6 XrdSfsGetFileSystem /afs/cern.ch/user/g/gbitzes/dev/eos-dev/mgm/XrdMgmOfs.cc:137 (libXrdEosMgm.so+0x0000004cc72f) #7 XrdXrootdloadFileSystem(XrdSysError*, XrdSfsFileSystem*, char*, int, char const*, XrdOucEnv*) <null> (libXrdServer.so.2+0x00000004be05) #8 XrdXrootdProtocol::Configure(char*, XrdProtocol_Config*) <null> (libXrdServer.so.2+0x000000045671) #9 XrdgetProtocol <null> (libXrdServer.so.2+0x000000055233) #10 XrdProtLoad::getProtocol(char const*, char const*, char*, XrdProtocol_Config*) <null> (xrootd+0x00000040de08) #11 XrdProtLoad::Load(char const*, char const*, char*, XrdProtocol_Config*) <null> (xrootd+0x00000040def2) #12 XrdConfig::Setup(char*) <null> (xrootd+0x0000004079ea) #13 XrdConfig::Configure(int, char**) <null> (xrootd+0x00000040c4be) #14 main <null> (xrootd+0x000000406465)
parent 2ae974e0
......@@ -305,7 +305,7 @@ public:
bool
OpenTransaction()
{
XrdMqRWMutexReadLock lock(mSom->HashMutex);
XrdMqRWMutexWriteLock lock(mSom->HashMutex);
if ((mHash = mSom->GetObject(mQueuePath.c_str(), "hash"))) {
mHash->OpenTransaction();
......@@ -321,7 +321,7 @@ public:
bool
CloseTransaction()
{
XrdMqRWMutexReadLock lock(mSom->HashMutex);
XrdMqRWMutexWriteLock lock(mSom->HashMutex);
if ((mHash = mSom->GetObject(mQueuePath.c_str(), "hash"))) {
mHash->CloseTransaction();
......@@ -337,7 +337,7 @@ public:
bool
SetId(fsid_t fsid)
{
XrdMqRWMutexReadLock lock(mSom->HashMutex);
XrdMqRWMutexWriteLock lock(mSom->HashMutex);
if ((mHash = mSom->GetObject(mQueuePath.c_str(), "hash"))) {
mHash->Set("id", (long long) fsid);
......@@ -353,7 +353,7 @@ public:
bool
SetString(const char* key, const char* str, bool broadcast = true)
{
XrdMqRWMutexReadLock lock(mSom->HashMutex);
XrdMqRWMutexWriteLock lock(mSom->HashMutex);
if ((mHash = mSom->GetObject(mQueuePath.c_str(), "hash"))) {
mHash->Set(key, str, broadcast);
......@@ -369,7 +369,7 @@ public:
bool
SetDouble(const char* key, double f, bool broadcast = true)
{
XrdMqRWMutexReadLock lock(mSom->HashMutex);
XrdMqRWMutexWriteLock lock(mSom->HashMutex);
if ((mHash = mSom->GetObject(mQueuePath.c_str(), "hash"))) {
mHash->Set(key, f, broadcast);
......@@ -385,7 +385,7 @@ public:
bool
SetLongLong(const char* key, long long l, bool broadcast = true)
{
XrdMqRWMutexReadLock lock(mSom->HashMutex);
XrdMqRWMutexWriteLock lock(mSom->HashMutex);
if ((mHash = mSom->GetObject(mQueuePath.c_str(), "hash"))) {
mHash->Set(key, l, broadcast);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment