Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix]curvefs: enableSumInDir in multi mount situation #2491

Merged
merged 1 commit into from
May 30, 2023

Conversation

bit-dance
Copy link
Contributor

@bit-dance bit-dance commented May 19, 2023

What problem does this PR solve?

Issue Number: #2094

Problem Summary:

What is changed and how it works?

When the fs mount is mounted multiple times with different enableSumInDir switches, the xattr information recorded in the metadata will be inaccurate.
What's Changed:
check the mds flag in lease_executor and update for fuse client
How it Works:
just like above
Side effects(Breaking backward compatibility? Performance regression?):

Check List

  • Relevant documentation/comments is changed or added
  • I acknowledge that all my contributions will be made under the project's license

@bit-dance
Copy link
Contributor Author

cicheck

return;
}

*fsinfo = wrapper.ProtoFsInfo();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*fsinfo not initialized, here temporary variable fsinfo here is not necessary
response->set_enablesumindir(wrapper.ProtoFsInfo().enablesumindir()); or Add method GetEnableSumInDir in class FsInfoWrapper and can use directly like response->set_enablesumindir(wrapper.GetEnableSumInDir())

@@ -532,6 +533,7 @@ MdsClientImpl::RefreshSession(const std::vector<PartitionTxId> &txIds,
LOG(INFO) << "RefreshSession need update partition txid list: "
<< response.DebugString();
}
*enableSumInDir = response.enablesumindir();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be thread safety issues here.

@bit-dance
Copy link
Contributor Author

cicheck

1 similar comment
@bit-dance
Copy link
Contributor Author

cicheck

Copy link
Contributor

@Ziy1-Tan Ziy1-Tan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(*enableSumInDir && !response.enablesumindir()) more clearly

@bit-dance
Copy link
Contributor Author

if(*enableSumInDir && !response.enablesumindir()) more clearly

Thx!And i will update in new version later.

@@ -532,6 +533,9 @@ MdsClientImpl::RefreshSession(const std::vector<PartitionTxId> &txIds,
LOG(INFO) << "RefreshSession need update partition txid list: "
<< response.DebugString();
}
if (*enableSumInDir == true && response.enablesumindir() == false) {
*enableSumInDir = response.enablesumindir();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use enableSumInDir->store(response.enablesumindir());

And change use enableSumInDir_ value to enableSumInDir_.load()

std::atomic::store and std::atomic::load is thread safety.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get it! I will change afternoon.

@bit-dance
Copy link
Contributor Author

cicheck

@bit-dance
Copy link
Contributor Author

cicheck

@@ -1446,14 +1448,15 @@ FuseClient::SetMountStatus(const struct MountOption *mountOption) {
}
inodeManager_->SetFsId(fsInfo_->fsid());
dentryManager_->SetFsId(fsInfo_->fsid());
enableSumInDir_ = fsInfo_->enablesumindir() && !FLAGS_enableCto;
enableSumInDir_.store(fsInfo_->enablesumindir() && !FLAGS_enableCto);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enableSumInDir_.store(fsInfo_->enablesumindir());
FLAGS_enableCto is no longer needed here.

@bit-dance
Copy link
Contributor Author

cicheck

@bit-dance
Copy link
Contributor Author

cicheck

@bit-dance bit-dance force-pushed the issue2094 branch 4 times, most recently from 99200a3 to 9dea224 Compare May 28, 2023 08:33
@bit-dance
Copy link
Contributor Author

cicheck

@bit-dance
Copy link
Contributor Author

cicheck

@bit-dance
Copy link
Contributor Author

cicheck

2 similar comments
@bit-dance
Copy link
Contributor Author

cicheck

@SeanHai
Copy link
Contributor

SeanHai commented May 29, 2023

cicheck

@SeanHai
Copy link
Contributor

SeanHai commented May 29, 2023

LGTM

@bit-dance bit-dance requested a review from Ziy1-Tan May 29, 2023 07:46
curvefs/src/client/rpcclient/mds_client.cpp Outdated Show resolved Hide resolved
std::shared_ptr<MdsClient> mdsCli)
: opt_(opt), metaCache_(metaCache), mdsCli_(mdsCli) {}
std::shared_ptr<MdsClient> mdsCli,
std::atomic<bool>* enableSumInDir = nullptr)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass by reference if enableSumInDir is never null. You can use //NOLINT to avoid cpplint.

curvefs/src/client/fuse_client.cpp Outdated Show resolved Hide resolved
curvefs/src/mds/fs_info_wrapper.cpp Outdated Show resolved Hide resolved
Signed-off-by: jbk <2634358021@qq.com>

add_atomic

Signed-off-by: jbk <2634358021@qq.com>
@Ziy1-Tan
Copy link
Contributor

cicheck

1 similar comment
@bit-dance
Copy link
Contributor Author

cicheck

@bit-dance bit-dance requested a review from Ziy1-Tan May 30, 2023 03:17
@SeanHai SeanHai merged commit 5a9772b into opencurve:master May 30, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants