Commit b6128a2e authored by Ren Bauer's avatar Ren Bauer Committed by Tigran Mkrtchyan
Browse files

Resolve "Open BackendVFS ObjectStore files in R/W mode when obtaining exclusive locks"

(cherry picked from commit 77bc79e6)
parent 1959d663
Pipeline #24082 passed with stages
in 27 minutes and 51 seconds
......@@ -254,7 +254,11 @@ void BackendVFS::ScopedLock::release() {
BackendVFS::ScopedLock * BackendVFS::lockHelper(std::string name, int type, uint64_t timeout_us) {
std::string path = m_root + "/." + name + ".lock";
std::unique_ptr<ScopedLock> ret(new ScopedLock);
ret->set(::open(path.c_str(), O_RDONLY), path);
int flag = O_RDONLY;
if (type == LOCK_EX) {
flag = O_RDWR;
ret->set(::open(path.c_str(), flag), path);
if(0 > ret->m_fd) {
// We went too fast: the fd is not really set:
Supports Markdown
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