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

fs: Fix the race condition in file_dup #2643

Merged
merged 2 commits into from Jan 8, 2021

Conversation

xiaoxiang781216
Copy link
Contributor

Summary

NULL inode passed to files_allocate doesn't mark file struct in the allocated state, so other threads which invovle in file allocation(e.g. open or dup) may allocate the same file struct again.
Let's use a temp file struct to avoid the NULL inode case.

Impact

Fix the race condition

Testing

…p1 succeed

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I10956f5e32cc0add414076465c06a24a858e52bc
NULL inode passed to files_allocate doesn't mark file struct in the
allocated state, so other threads which invovle in file allocation
(e.g. open or dup) may allocate the same file struct again.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I53ff876eae3c7a1e311e7f671686b73a4b4ef891
Copy link
Contributor

@anchao anchao left a comment

Choose a reason for hiding this comment

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

LGTM

@anchao anchao merged commit 86fab49 into apache:master Jan 8, 2021
@xiaoxiang781216 xiaoxiang781216 deleted the file_dup branch January 8, 2021 03:04
@btashton btashton added this to To-Add in Release Notes - 10.1.0 Apr 12, 2021
@jerpelea jerpelea moved this from To-Add to Minor in Release Notes - 10.1.0 Apr 12, 2021
@jerpelea jerpelea moved this from Minor to Added in Release Notes - 10.1.0 Apr 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants