Skip to content

Eliminate possible race between LockFile() vs UnlockFile()#7721

Closed
azat wants to merge 1 commit intofacebook:masterfrom
azat-archive:fix-LockFile-UnlockFile-race
Closed

Eliminate possible race between LockFile() vs UnlockFile()#7721
azat wants to merge 1 commit intofacebook:masterfrom
azat-archive:fix-LockFile-UnlockFile-race

Conversation

@azat
Copy link
Copy Markdown
Contributor

@azat azat commented Nov 29, 2020

LockFile() accessing LockHoldingInfo (element of locked_files) by
reference after mutex_locked_files had been released.

LockFile() accessing LockHoldingInfo (element of locked_files) by
reference after mutex_locked_files had been released.
Copy link
Copy Markdown
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@jay-zhuang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Copy Markdown
Contributor

@jay-zhuang jay-zhuang left a comment

Choose a reason for hiding this comment

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

Thanks @azat for the patch. LGTM.

Otherwise, it_success might be invalid after:

rocksdb/env/fs_posix.cc

Lines 813 to 816 in 7b2216c

mutex_locked_files.Lock();
// If we are unlocking, then verify that we had locked it earlier,
// it should already exist in locked_files. Remove it from locked_files.
if (locked_files.erase(my_lock->filename) != 1) {

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@jay-zhuang merged this pull request in 40f2b65.

codingrhythm pushed a commit to SafetyCulture/rocksdb that referenced this pull request Mar 5, 2021
…7721)

Summary:
LockFile() accessing LockHoldingInfo (element of locked_files) by
reference after mutex_locked_files had been released.

Pull Request resolved: facebook#7721

Reviewed By: pdillinger

Differential Revision: D25431839

Pulled By: jay-zhuang

fbshipit-source-id: eefee93f12a8016a98e2466e442af2605b3e2a5e
levichen94 pushed a commit to bytedance/terarkdb that referenced this pull request Jun 18, 2021
Summary:
LockFile() accessing LockHoldingInfo (element of locked_files) by
reference after mutex_locked_files had been released.

Pull Request resolved: facebook/rocksdb#7721

Reviewed By: pdillinger

Differential Revision: D25431839

Pulled By: jay-zhuang

fbshipit-source-id: eefee93f12a8016a98e2466e442af2605b3e2a5e
Signed-off-by: Changlong Chen <levisonchen@live.cn>
mm304321141 pushed a commit to bytedance/terarkdb that referenced this pull request Jun 23, 2021
Summary:
LockFile() accessing LockHoldingInfo (element of locked_files) by
reference after mutex_locked_files had been released.

Pull Request resolved: facebook/rocksdb#7721

Reviewed By: pdillinger

Differential Revision: D25431839

Pulled By: jay-zhuang

fbshipit-source-id: eefee93f12a8016a98e2466e442af2605b3e2a5e
Signed-off-by: Changlong Chen <levisonchen@live.cn>
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.

3 participants