mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2026-04-25 05:16:00 +03:00
[PR #1996] [MERGED] Fixed race condition in dirname and basename call #2291
Labels
No labels
bug
bug
dataloss
duplicate
enhancement
feature request
help wanted
invalid
need info
performance
pull-request
question
question
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/s3fs-fuse#2291
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/1996
Author: @ggtakec
Created: 7/24/2022
Status: ✅ Merged
Merged: 7/24/2022
Merged by: @gaul
Base:
master← Head:fix_basename📝 Commits (1)
39d6dbeFixed race condition in dirname and basename call📊 Changes
3 files changed (+77 additions, -0 deletions)
View changed files
📝
src/s3fs.cpp(+20 -0)📝
src/s3fs_util.cpp(+55 -0)📝
src/s3fs_util.h(+2 -0)📄 Description
Relevant Issue (if applicable)
#1987
#1994
Details
The cause of
test_truncate_cachetest error was a race between threads in thedirnamecall.(Only confirmed with macos10)This happened because in
test_truncate_cachetest,s3fs_getattrwas called by another thread while callinglist_bucket.Specifically, another
dirnamecall was made shortly during receiving a static pointer fromdirnameand setting it tostd::stringbuffer.Therefore, the value set in
std::stringwas replaced with the result called by another thread.To fix this, we introduced
mutexfor exclusive control ofdirnameandbasename(which return pointers to static variables).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.