-
Notifications
You must be signed in to change notification settings - Fork 85
vhost: fix double-locking in Backend to Frontend request handlers #338
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
base: main
Are you sure you want to change the base?
vhost: fix double-locking in Backend to Frontend request handlers #338
Conversation
Add a From trait implementation to convert vhost_user::Error to io::Error. This allows using the ? operator for cleaner error handling in methods that return io::Result. Signed-off-by: Stefano Garzarella <[email protected]>
8d6d22e to
51e27fe
Compare
|
@stefano-garzarella LGTM, can you fix the commit length?
|
sure, thanks for the reminder (I hate that rule xD) |
51e27fe to
c5101fc
Compare
Rename the `node` field to `inner` and remove the `node()` helper method, replacing all usages with direct `self.inner.lock().unwrap()` calls for better explicitness. Suggested-by: Manos Pitsidianakis <[email protected]> Signed-off-by: Stefano Garzarella <[email protected]>
Some methods acquire the mutex lock twice: once to check feature flags and again when calling send_message(), this is inefficient and also racy, so acquire the lock once and reuse the guard for both operations. Remove send_message() wrapper method now unused. Signed-off-by: Stefano Garzarella <[email protected]>
c5101fc to
8133d3f
Compare
|
@stefano-garzarella weird error, is this even related to the changes? |
mmm, I already saw that, I think we have some little race between tests reusing the same vsock CID. I'll fix it, but yeah, it's unrelated. Let me restart them. |
Summary of the PR
Some methods acquire the mutex lock twice: once to check feature flags
and again when calling send_message(), this is inefficient and also
racy, so acquire the lock once and reuse the guard for both operations.
Remove send_message() wrapper method now unused.
The first 2 patches are just in preparation to clarify method and avoid
mapping errors all over the places.
This was initially discussed at: #251 (comment)
Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafecode is properly documented.