Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

sync: Flush all caches when destroying the pod#169

Merged
sameo merged 1 commit into
masterfrom
sboeuf/sync_from_destroypod
Nov 16, 2017
Merged

sync: Flush all caches when destroying the pod#169
sameo merged 1 commit into
masterfrom
sboeuf/sync_from_destroypod

Conversation

@sboeuf
Copy link
Copy Markdown

@sboeuf sboeuf commented Nov 16, 2017

sync: Flush all caches when destroying the pod

When DESTROYPOD command is called, this means the VM is going to be
shut down right after. Because we don't want to shut down the VM with
some pending buffers, this patch calls into sync() system call to make
sure all buffers are flushed.

From sync() man page:
"According to the standard specification (e.g., POSIX.1-2001), sync()
 schedules the writes, but may return before the actual writing is
 done. However Linux waits for I/O completions, and thus sync() or
 syncfs() provide the same guarantees as fsync called on every file
 in the system or filesystem respectively."

This will ensure that sync() will block until all buffers are properly
flushed.

Fixes #168

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>

When DESTROYPOD command is called, this means the VM is going to be
shut down right after. Because we don't want to shut down the VM with
some pending buffers, this patch calls into sync() system call to make
sure all buffers are flushed.

From sync() man page:
"According to the standard specification (e.g., POSIX.1-2001), sync()
 schedules the writes, but may return before the actual writing is
 done. However Linux waits for I/O completions, and thus sync() or
 syncfs() provide the same guarantees as fsync called on every file
 in the system or filesystem respectively."

This will ensure that sync() will block until all buffers are properly
flushed.

Fixes #168

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
@sboeuf
Copy link
Copy Markdown
Author

sboeuf commented Nov 16, 2017

cc @mcastelino @amshinde @sameo

Copy link
Copy Markdown
Contributor

@mcastelino mcastelino left a comment

Choose a reason for hiding this comment

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

LGTM

@sameo
Copy link
Copy Markdown

sameo commented Nov 16, 2017

LGTM

Approved with PullApprove Approved with PullApprove

@sameo sameo merged commit c046ec0 into master Nov 16, 2017
@sameo sameo removed the in progress label Nov 16, 2017
@sboeuf sboeuf deleted the sboeuf/sync_from_destroypod branch January 10, 2018 21:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants