diff options
| author | Pavel Moravec <pmoravec@apache.org> | 2014-10-17 08:21:58 +0000 |
|---|---|---|
| committer | Pavel Moravec <pmoravec@apache.org> | 2014-10-17 08:21:58 +0000 |
| commit | 846ef8194265991739c54ae16966cc4c185bcc8a (patch) | |
| tree | 93b7965c0174405a6d6c5b762e7e724d4d62f842 /qpid/cpp/src | |
| parent | 94855e3bb1b74ad9f4a5fe0bbba0fb1c32672e48 (diff) | |
| download | qpid-python-846ef8194265991739c54ae16966cc4c185bcc8a.tar.gz | |
QPID-6157: linearstore: segfault when 2 journals request new journal file from empty EFP
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1632504 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
| -rw-r--r-- | qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp b/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp index 4ad68d9a3b..a69ab09001 100644 --- a/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp +++ b/qpid/cpp/src/qpid/linearstore/journal/EmptyFilePool.cpp @@ -173,10 +173,11 @@ efpDataSize_kib_t EmptyFilePool::dataSizeFromDirName_kib(const std::string& dirN // --- protected functions --- +// WARNING: this method needs to be called under the scope of emptyFileListMutex_ lock void EmptyFilePool::createEmptyFile() { std::string efpfn = getEfpFileName(); if (overwriteFileContents(efpfn)) { - pushEmptyFile(efpfn); + emptyFileList_.push_back(efpfn); } } @@ -207,16 +208,11 @@ bool EmptyFilePool::overwriteFileContents(const std::string& fqFileName) { std::string EmptyFilePool::popEmptyFile() { std::string emptyFileName; - bool isEmpty = false; - { - slock l(emptyFileListMutex_); - isEmpty = emptyFileList_.empty(); - } - if (isEmpty) { - createEmptyFile(); - } { slock l(emptyFileListMutex_); + if (emptyFileList_.empty()) { + createEmptyFile(); + } emptyFileName = emptyFileList_.front(); emptyFileList_.pop_front(); } |
