Loading include/client/rpc/repair_journal_lock.hpp +12 −3 Changes for include/client/rpc/repair_journal_lock.hpp: 12 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -13,7 +13,6 @@ #include <common/unique_fd.hpp> #include <fcntl.h> #include <sys/file.h> #include <unistd.h> #include <cerrno> Loading Loading @@ -66,7 +65,12 @@ public: } gkfs::utils::unique_fd candidate(fd); if(::flock(candidate.get(), LOCK_EX | LOCK_NB) != 0) { struct flock lock{}; lock.l_type = F_WRLCK; lock.l_whence = SEEK_SET; lock.l_start = 0; lock.l_len = 0; if(::fcntl(candidate.get(), F_OFD_SETLK, &lock) != 0) { const auto error = errno; if(error == EWOULDBLOCK || error == EAGAIN) { throw std::runtime_error( Loading Loading @@ -110,7 +114,12 @@ public: void release() noexcept { if(fd_) { ::flock(fd_.get(), LOCK_UN); struct flock lock{}; lock.l_type = F_UNLCK; lock.l_whence = SEEK_SET; lock.l_start = 0; lock.l_len = 0; ::fcntl(fd_.get(), F_OFD_SETLK, &lock); fd_.reset(); } lock_path_.clear(); Loading Loading
include/client/rpc/repair_journal_lock.hpp +12 −3 Changes for include/client/rpc/repair_journal_lock.hpp: 12 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -13,7 +13,6 @@ #include <common/unique_fd.hpp> #include <fcntl.h> #include <sys/file.h> #include <unistd.h> #include <cerrno> Loading Loading @@ -66,7 +65,12 @@ public: } gkfs::utils::unique_fd candidate(fd); if(::flock(candidate.get(), LOCK_EX | LOCK_NB) != 0) { struct flock lock{}; lock.l_type = F_WRLCK; lock.l_whence = SEEK_SET; lock.l_start = 0; lock.l_len = 0; if(::fcntl(candidate.get(), F_OFD_SETLK, &lock) != 0) { const auto error = errno; if(error == EWOULDBLOCK || error == EAGAIN) { throw std::runtime_error( Loading Loading @@ -110,7 +114,12 @@ public: void release() noexcept { if(fd_) { ::flock(fd_.get(), LOCK_UN); struct flock lock{}; lock.l_type = F_UNLCK; lock.l_whence = SEEK_SET; lock.l_start = 0; lock.l_len = 0; ::fcntl(fd_.get(), F_OFD_SETLK, &lock); fd_.reset(); } lock_path_.clear(); Loading