Thanks to visit codestin.com
Credit goes to github.com

Skip to content

block: qcow2: Flush the buffer explicitly when writing pointer table - #7528

Merged
rbradford merged 1 commit into
cloud-hypervisor:mainfrom
liuw:qcow2-flush-pointer-table-buffer
Nov 30, 2025
Merged

rbradford merged 1 commit into
cloud-hypervisor:mainfrom
liuw:qcow2-flush-pointer-table-buffer

Conversation

@liuw

@liuw liuw commented Nov 29, 2025

Copy link
Copy Markdown
Member

Previously the code relies on the implicit flush when BufWriter is dropped. That's not safe.

Per BufWriter's document:

It is critical to call flush before BufWriter<W> is dropped. Though
dropping will attempt to flush the contents of the buffer, any errors
that happen in the process of dropping will be ignored. Calling flush
ensures that the buffer is empty and thus dropping will not even attempt
file operations.

Previously the code relies on the implicit flush when BufWriter is
dropped. That's not safe.

Per BufWriter's document:

```
It is critical to call flush before BufWriter<W> is dropped. Though
dropping will attempt to flush the contents of the buffer, any errors
that happen in the process of dropping will be ignored. Calling flush
ensures that the buffer is empty and thus dropping will not even attempt
file operations.
```

Signed-off-by: Wei Liu <[email protected]>
@liuw
liuw requested a review from a team as a code owner November 29, 2025 20:10
@rbradford
rbradford added this pull request to the merge queue Nov 30, 2025
Merged via the queue into cloud-hypervisor:main with commit 8555695 Nov 30, 2025
43 checks passed
@liuw
liuw deleted the qcow2-flush-pointer-table-buffer branch December 1, 2025 06:12
@likebreath likebreath added the bug-fix Bug fix to include in release notes label Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix Bug fix to include in release notes

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

4 participants