Trigger sync right after writing.

This can trigger the sync mechanism earlier so that the kernel has enough
time to schedule a real disk sync before system reboots.

BUG=chromium-os:35992
TEST=compile only
BRANCH=none

Change-Id: I505fdf45d95a52c9eca7687ecd6fb9f6be8cc5f1
Reviewed-on: https://gerrit.chromium.org/gerrit/41269
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Yung-Chieh Lo <yjlou@chromium.org>
Commit-Queue: Yung-Chieh Lo <yjlou@chromium.org>
This commit is contained in:
Louis Yung-Chieh Lo
2013-01-15 13:13:07 +08:00
committed by ChromeBot
parent 826db09fce
commit f3613b60c7

View File

@@ -269,7 +269,12 @@ int DriveClose(struct drive *drive, int update_as_needed) {
}
}
// Sync early!
fsync(drive->fd);
syncfs(drive->fd);
close(drive->fd);
sync();
if (drive->gpt.primary_header)
free(drive->gpt.primary_header);