summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Crane <cranes@google.com>2022-08-04 20:30:31 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-08-04 20:30:31 +0000
commit19ddf44919c7b9dda647d4a87da6ea8a72cbc5d4 (patch)
treecdc0ec066c46129624e57d670622abf3b34009b6
parenta70049022b53abca4e1b94a0fa0da140436f31ee (diff)
parent5b02ed521ccbb52e727364769aa4514f58055f82 (diff)
downloadcore-19ddf44919c7b9dda647d4a87da6ea8a72cbc5d4.tar.gz
storageproxy: Support POST_COMMIT sync for all commands am: 5b02ed521c
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/19517836 Change-Id: I3aeeb035f1168bd2c9bdbba43ddd014c92d8a8c9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--trusty/storage/proxy/proxy.c7
-rw-r--r--trusty/storage/proxy/storage.c8
2 files changed, 12 insertions, 3 deletions
diff --git a/trusty/storage/proxy/proxy.c b/trusty/storage/proxy/proxy.c
index 262003427..ed670b7fe 100644
--- a/trusty/storage/proxy/proxy.c
+++ b/trusty/storage/proxy/proxy.c
@@ -116,10 +116,11 @@ static int drop_privs(void) {
static int handle_req(struct storage_msg* msg, const void* req, size_t req_len) {
int rc;
- if ((msg->flags & STORAGE_MSG_FLAG_POST_COMMIT) && (msg->cmd != STORAGE_RPMB_SEND)) {
+ if ((msg->flags & STORAGE_MSG_FLAG_POST_COMMIT) && msg->cmd != STORAGE_RPMB_SEND &&
+ msg->cmd != STORAGE_FILE_WRITE) {
/*
- * handling post commit messages on non rpmb commands are not
- * implemented as there is no use case for this yet.
+ * handling post commit messages on commands other than rpmb and write
+ * operations are not implemented as there is no use case for this yet.
*/
ALOGE("cmd 0x%x: post commit option is not implemented\n", msg->cmd);
msg->result = STORAGE_ERR_UNIMPLEMENTED;
diff --git a/trusty/storage/proxy/storage.c b/trusty/storage/proxy/storage.c
index c00c399d9..2fedcce6d 100644
--- a/trusty/storage/proxy/storage.c
+++ b/trusty/storage/proxy/storage.c
@@ -407,6 +407,14 @@ int storage_file_write(struct storage_msg *msg,
goto err_response;
}
+ if (msg->flags & STORAGE_MSG_FLAG_POST_COMMIT) {
+ rc = storage_sync_checkpoint();
+ if (rc < 0) {
+ msg->result = STORAGE_ERR_GENERIC;
+ goto err_response;
+ }
+ }
+
msg->result = STORAGE_NO_ERROR;
err_response: