-
Notifications
You must be signed in to change notification settings - Fork 124
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 dead lock in ExportPerformer #503
Conversation
@@ -104,6 +108,8 @@ int callbackvoid(void*, AsyncResult<void>* ret) { | |||
} | |||
|
|||
TEST(ExportFS, basic) { | |||
photon_init(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not doing init in main()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other tests like ExportFS.no_xattr_sync run in pthread rather than photon thread.
fs/async_filesystem.cpp
Outdated
std::condition_variable _cond; | ||
bool _got_it = false; | ||
typename AsyncResult<R>::result_type ret; | ||
int err = 0; | ||
|
||
AsyncWaiter() : _lock(_mtx) { } | ||
AsyncWaiter() { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for a ctor anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
How about PR to 0.7 as well? |
will do it after this PR is approved. |
When using an exported fs,ExportPerformer put called function to a SPSCRingQueue and wait to be waked when finished. Related code is below:
In situations where
_if->*func
is unimplemented, the function_if->*func
will callw.done()
directly, which cause a dead lock beacuse it try to lock a locked mutex.This pr do the following things:
ExportFS.no_xattr_sync
to verify this dead lock behavior.fallocate
fuction of ExportAsAsyncFile because this method is widely used in fuse.Besides, I marked the unittest ExportFS.xattr_sync as DISABLED for now. Because this test failed on MacOS only when compiled as release. Hope someone can fix it.