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: avoid inode unlink due to net error #402

Merged

Conversation

shuoranliu
Copy link
Member

When creating a file, the client will create inode first and then send a
create dentry request. If create dentry request fails due to a net
error (e.g. send the request to metanode but timed out when getting
response), there is a tiny chance that the dentry is created
successfully on metanode. Thus we cannot unlink the inode created
previously because we would rather leave the orphan inode than create
an orphan dentry.

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

What this PR does / why we need it:

The principle is orphan inode rather than orphan dentry. The PR tries to avoid the tiny chance of orphan dentry.

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

Special notes for your reviewer:

Release note:

When creating a file, the client will create inode first and then send a
create dentry request. If create dentry request fails due to a net
error (e.g. send the request to metanode but timed out when getting
response), there is a tiny chance that the dentry is created
successfully on metanode. Thus we cannot unlink the inode created
previously because we would rather leave the orphan inode than create
an orphan dentry.

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

@awzhgw awzhgw left a comment

Choose a reason for hiding this comment

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

review+1

@awzhgw awzhgw merged commit 460321e into cubefs:master Mar 5, 2020
@mervinkid mervinkid added the component/metanode Topic about MetaNode label Mar 18, 2020
@shuoranliu shuoranliu deleted the fix-avoid-inode-unlink-due-to-net-error branch June 22, 2020 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/metanode Topic about MetaNode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants