Skip to content

Commit

Permalink
curvefs/mds: fix create partition error at parallel case
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanHai committed May 26, 2022
1 parent 9da8b12 commit fc2a7dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions curvefs/src/mds/topology/topology_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,9 @@ void TopologyManager::CreatePartitions(const CreatePartitionRequest *request,
auto partitionInfoList = response->mutable_partitioninfolist();
response->set_statuscode(TopoStatusCode::TOPO_OK);

// get lock and avoid multiMountpoint create concurrently
NameLockGuard lock(createPartitionMutex_, std::to_string(fsId));

while (partitionInfoList->size() < count) {
if (topology_->GetAvailableCopysetNum()
< option_.minAvailableCopysetNum) {
Expand Down
2 changes: 2 additions & 0 deletions curvefs/src/mds/topology/topology_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ class TopologyManager {
*/
NameLock registMsMutex;

NameLock createPartitionMutex_;

/**
* @brief topology options
*/
Expand Down

0 comments on commit fc2a7dd

Please sign in to comment.