-
Notifications
You must be signed in to change notification settings - Fork 526
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_enable #2340
fix_enable #2340
Conversation
curvefs/src/client/fuse_client.cpp
Outdated
@@ -198,7 +198,7 @@ CURVEFS_ERROR FuseClient::FuseOpInit(void *userdata, | |||
} | |||
inodeManager_->SetFsId(fsInfo_->fsid()); | |||
dentryManager_->SetFsId(fsInfo_->fsid()); | |||
enableSumInDir_ = fsInfo_->enablesumindir() && !FLAGS_enableCto; | |||
enableSumInDir_ = fsInfo_->enablesumindir(); | |||
if (fsInfo_->has_recycletimehour()) { | |||
enableSumInDir_ = enableSumInDir_ && (fsInfo_->recycletimehour() == 0); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code review
The given patch looks correct, it is changing the value of enableSumInDir_ to be equal to the "enablesumindir" value from fsInfo_, removing the FLAGS_enableCto condition.
It would be beneficial to add a comment explaining the purpose of this change and any assumptions made when making this change. This will help other developers understand why this change was made and prevent any unexpected behavior.
It is also important to ensure that this change does not break any existing functionality. Thorough testing should be done to ensure that any possible scenarios are tested before pushing this change to production.
@@ -113,6 +113,9 @@ void FsInfoWrapper::AddMountPoint(const Mountpoint& mp) { | |||
*p = mp; | |||
|
|||
fsInfo_.set_mountnum(fsInfo_.mountnum() + 1); | |||
if(fsInfo_.mountnum()>1){ | |||
fsInfo_.set_enablesumindir(false); | |||
} | |||
} | |||
|
|||
FSStatusCode FsInfoWrapper::DeleteMountPoint(const Mountpoint& mp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code review
-
The first thing to check is the syntax of the code. Make sure that all the braces, semicolons and parentheses are present in the right places.
-
Look for any logical errors in the code. For example, if the mountnum is greater than 1, then the enablesumindir should be set to false.
-
Check if the code is optimized. For example, you can use a ternary operator instead of an if statement.
-
Check for any security risks. For example, is the data sanitized before being used?
-
Check if the code follows the coding style guide of your organization.
-
Test the code to make sure it works as expected.
-
If the code is part of a larger system, check if it integrates properly with other components.
cicheck |
1 similar comment
cicheck |
fix cpplint error Signed-off-by: jbk <[email protected]>
curvefs/src/client/fuse_client.cpp
Outdated
@@ -198,7 +198,7 @@ CURVEFS_ERROR FuseClient::FuseOpInit(void *userdata, | |||
} | |||
inodeManager_->SetFsId(fsInfo_->fsid()); | |||
dentryManager_->SetFsId(fsInfo_->fsid()); | |||
enableSumInDir_ = fsInfo_->enablesumindir() && !FLAGS_enableCto; | |||
enableSumInDir_ = fsInfo_->enablesumindir(); | |||
if (fsInfo_->has_recycletimehour()) { | |||
enableSumInDir_ = enableSumInDir_ && (fsInfo_->recycletimehour() == 0); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with code review:
The patch changes the code from disabling enableSumInDir_ if FLAGS_enableCto is set to not disabling it regardless of the value of FLAGS_enableCto. This change seems reasonable as it would allow enableSumInDir_ to be enabled even if FLAGS_enableCto is set. However, it is important to note that this might have unintended consequences depending on the implementation of FLAGS_enableCto. It is recommended to check the implementation of FLAGS_enableCto and ensure that this change does not have any unexpected side-effects.
@@ -113,6 +113,9 @@ void FsInfoWrapper::AddMountPoint(const Mountpoint& mp) { | |||
*p = mp; | |||
|
|||
fsInfo_.set_mountnum(fsInfo_.mountnum() + 1); | |||
if (fsInfo_.mountnum() > 1) { | |||
fsInfo_.set_enablesumindir(false); | |||
} | |||
} | |||
|
|||
FSStatusCode FsInfoWrapper::DeleteMountPoint(const Mountpoint& mp) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with understanding the code.
The code is about updating the MountPoint of FsInfoWrapper, which is a class for manipulating mount point information. It contains two methods: AddMountPoint and DeleteMountPoint.
The code patch adds a new line in the AddMountPoint method, which sets the enablesumindir field to false if the mountnum is greater than 1. This is necessary because the mountnum indicates the number of mount points, and if there are more than one mount points, then enablesumindir should be false.
From a bug risk perspective, this patch looks okay. However, it would be beneficial to add a comment that explains the purpose of setting the enablesumindir field to false when mountnum is greater than 1. This will make it easier for other developers to understand the code. Additionally, it might be worth adding a check to make sure that mountnum is not greater than the maximum allowed mount points, before setting enablesumindir to false.
cicheck |
1 similar comment
cicheck |
|
Ok,i will research this part later |
cicheck |
curvefs/src/mds/fs_info_wrapper.cpp
Outdated
@@ -113,6 +113,9 @@ void FsInfoWrapper::AddMountPoint(const Mountpoint& mp) { | |||
*p = mp; | |||
|
|||
fsInfo_.set_mountnum(fsInfo_.mountnum() + 1); | |||
if (fsInfo_.mountnum() > 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// stats are not cached in xattr in multi-mount scenarios
if (fsInfo_.enablesumindir() && fsInfo_.mountnum() > 1) {
fsInfo_.set_enablesumindir(false);
}
@bit-dance |
@bit-dance Will you continue to follow up this PR? |
Yes,these times i am dealing with my exams and later i will continue following codes. |
@bit-dance feel free to continue. |
@caoxianfei1 I am so sorry but i will have time to continue next week. |
What problem does this PR solve?
In multi mount situation,the xattr information will wrong and we can not use the sum to calculate the file bytes.
Issue Number: #2094
Problem Summary:
When the fs mount is mounted multiple times with different enableSumInDir switches, the xattr information recorded in the metadata will be inaccurate.
What is changed and how it works?
If mds find there are multi mounts and then it will close the enableSumInDir forever.
What's Changed:
fuse_client.cpp fs_info_wrapper.cpp
How it Works:
just like above
Side effects(Breaking backward compatibility? Performance regression?):
Maybe we can't use the sum xattr later if we close the enableSumInDir.
Check List