From 07f0b98341e064e7ed83ed9fbf50d78ed634a0c4 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 11 Sep 2020 07:13:22 +0000 Subject: [PATCH 1/3] Fix race condition between C_FindObjects and object creation (issue 573) --- src/lib/object_store/ObjectFile.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/object_store/ObjectFile.cpp b/src/lib/object_store/ObjectFile.cpp index f3becbe0e..f88f0df9a 100644 --- a/src/lib/object_store/ObjectFile.cpp +++ b/src/lib/object_store/ObjectFile.cpp @@ -322,7 +322,7 @@ void ObjectFile::refresh(bool isFirstTime /* = false */) { DEBUG_MSG("Object %s is empty", path.c_str()); - valid = false; + objectFile.unlock(); return; } @@ -707,6 +707,8 @@ void ObjectFile::store(bool isCommit /* = false */) } } + objectFile.flush(); + valid = true; } From 41d153a5ac1df166b9edb7ee9f0d101570a3a09a Mon Sep 17 00:00:00 2001 From: Roland van Rijswijk Date: Fri, 11 Sep 2020 10:24:34 +0200 Subject: [PATCH 2/3] Update ObjectFile.cpp Fix indenting --- src/lib/object_store/ObjectFile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/object_store/ObjectFile.cpp b/src/lib/object_store/ObjectFile.cpp index f88f0df9a..acec905e4 100644 --- a/src/lib/object_store/ObjectFile.cpp +++ b/src/lib/object_store/ObjectFile.cpp @@ -321,8 +321,8 @@ void ObjectFile::refresh(bool isFirstTime /* = false */) if (objectFile.isEmpty()) { DEBUG_MSG("Object %s is empty", path.c_str()); - - objectFile.unlock(); + + objectFile.unlock(); return; } @@ -707,7 +707,7 @@ void ObjectFile::store(bool isCommit /* = false */) } } - objectFile.flush(); + objectFile.flush(); valid = true; } From 4e1d1c8e8b6f2996b94c26d1b25c18971d4874c6 Mon Sep 17 00:00:00 2001 From: Roland van Rijswijk Date: Fri, 18 Sep 2020 09:15:31 +0200 Subject: [PATCH 3/3] Update ObjectFile.cpp Removed `flush()` that will become unnecessary when #578 is merged. --- src/lib/object_store/ObjectFile.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib/object_store/ObjectFile.cpp b/src/lib/object_store/ObjectFile.cpp index acec905e4..6d54361db 100644 --- a/src/lib/object_store/ObjectFile.cpp +++ b/src/lib/object_store/ObjectFile.cpp @@ -707,8 +707,6 @@ void ObjectFile::store(bool isCommit /* = false */) } } - objectFile.flush(); - valid = true; }