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: checks only file type instead of the whole mode #381

Merged

Conversation

shuoranliu
Copy link
Member

Meta node checks the dentry file mode when dealing with CreateDentry
request if the target dentry already exists to avoid files replacement
with different types, i.e. rename a regular file to overwrite a
directory. However, file mode contains permission bits as well as file
type bits. And we certainly do not want permissions involved in such
situation. So mask the file mode to compare file type bits only.

Signed-off-by: Shuoran Liu shuoranliu@gmail.com

What this PR does / why we need it:

Fix inappropriate file mode checks in meta node when dealing with create dentry requests.

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

N/A

Special notes for your reviewer:

Compare only the file types but not permissions.

Release note:

N/A

Meta node checks the dentry file mode when dealing with CreateDentry
request if the target dentry already exists to avoid files replacement
with different types, i.e. rename a regular file to overwrite a
directory. However, file mode contains permission bits as well as file
type bits. And we certainly do not want permissions involved in such
situation. So mask the file mode to compare file type bits only.

Signed-off-by: Shuoran Liu <shuoranliu@gmail.com>
Copy link
Member

@mervinkid mervinkid left a comment

Choose a reason for hiding this comment

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

Approve

@mervinkid mervinkid added the enhancement New feature or request label Feb 21, 2020
@awzhgw awzhgw merged commit 14d9a8e into cubefs:master Feb 22, 2020
@shuoranliu shuoranliu deleted the fix-metanode-inappropriate-file-mode-check branch June 22, 2020 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants