summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2013-01-16 11:52:17 +0800
committerYung-Chieh Lo <yjlou@chromium.org>2013-01-29 20:02:38 -0800
commitf862c6241302ac122df063cc53a97582841dbc6f (patch)
tree04ec0759401b96c1a8f9afaa455eae529d4afd00
parent5da006cf6626659fe5f45363a15542e68e25e1ff (diff)
downloadvboot-stabilize-3428.149.B.tar.gz
(cherry-pick for R25)(modify and resend) Trigger sync right after writing.stabilize-3428.193stabilize-3428.149.Bstabilize-3428.149release-R25-3428.B
This can trigger the sync mechanism earlier so that the kernel has enough time to schedule a real disk sync before system reboots. We sent this in CL 41269, however it is reverted because the sync() and syncfs() make test cases timeout (tons of disk access). So we only sync file itself in this CL and leave the whoe system sync outside cgpt. BUG=chromium-os:35992 TEST=make && make runtests ; and trybot BRANCH=none Original-Change-Id: I9c6b602220131f1f011e7865788a122d4c379e73 (cherry picked from commit 8e9b61a8f9e0d1446a2ac98db1959ed561880d91) Change-Id: I5f419332cc5887d734f507533927e049e6cfbbf0 Reviewed-on: https://gerrit.chromium.org/gerrit/42211 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Yung-Chieh Lo <yjlou@chromium.org> Tested-by: Yung-Chieh Lo <yjlou@chromium.org>
-rw-r--r--cgpt/cgpt_common.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cgpt/cgpt_common.c b/cgpt/cgpt_common.c
index 193f2e1e..8def05ef 100644
--- a/cgpt/cgpt_common.c
+++ b/cgpt/cgpt_common.c
@@ -269,6 +269,11 @@ int DriveClose(struct drive *drive, int update_as_needed) {
}
}
+ // Sync early! Only sync file descriptor here, and leave the whole system sync
+ // outside cgpt because whole system sync would trigger tons of disk accesses
+ // and timeout tests.
+ fsync(drive->fd);
+
close(drive->fd);
if (drive->gpt.primary_header)