summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Crane <cranes@google.com>2022-08-04 20:30:33 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-08-04 20:30:33 +0000
commit6e48a1e5797a91a170ad898239c788b03e39c039 (patch)
tree8b72bae35b8e64328eb0e4aca76c7b2974dcddf4
parent19ddf44919c7b9dda647d4a87da6ea8a72cbc5d4 (diff)
parentcf458bae1e9cbd7014114d14223886daa5be7d98 (diff)
downloadcore-6e48a1e5797a91a170ad898239c788b03e39c039.tar.gz
storageproxy: Report fsync failures with a distinct error code am: cf458bae1e
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/19517837 Change-Id: I0cec6b12306b037503160b56ceecdb95acc4bde3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--trusty/storage/interface/include/trusty/interface/storage.h4
-rw-r--r--trusty/storage/proxy/proxy.c2
-rw-r--r--trusty/storage/proxy/storage.c2
3 files changed, 6 insertions, 2 deletions
diff --git a/trusty/storage/interface/include/trusty/interface/storage.h b/trusty/storage/interface/include/trusty/interface/storage.h
index 3f1dcb8c6..255ade127 100644
--- a/trusty/storage/interface/include/trusty/interface/storage.h
+++ b/trusty/storage/interface/include/trusty/interface/storage.h
@@ -70,6 +70,9 @@ enum storage_cmd {
* @STORAGE_ERR_TRANSACT returned by various operations to indicate that current transaction
* is in error state. Such state could be only cleared by sending
* STORAGE_END_TRANSACTION message.
+ * @STORAGE_ERR_SYNC_FAILURE indicates that the current operation failed to sync
+ * to disk. Only returned if STORAGE_MSG_FLAG_PRE_COMMIT or
+ * STORAGE_MSG_FLAG_POST_COMMIT was set for the request.
*/
enum storage_err {
STORAGE_NO_ERROR = 0,
@@ -80,6 +83,7 @@ enum storage_err {
STORAGE_ERR_NOT_FOUND = 5,
STORAGE_ERR_EXIST = 6,
STORAGE_ERR_TRANSACT = 7,
+ STORAGE_ERR_SYNC_FAILURE = 8,
};
/**
diff --git a/trusty/storage/proxy/proxy.c b/trusty/storage/proxy/proxy.c
index ed670b7fe..f01589287 100644
--- a/trusty/storage/proxy/proxy.c
+++ b/trusty/storage/proxy/proxy.c
@@ -130,7 +130,7 @@ static int handle_req(struct storage_msg* msg, const void* req, size_t req_len)
if (msg->flags & STORAGE_MSG_FLAG_PRE_COMMIT) {
rc = storage_sync_checkpoint();
if (rc < 0) {
- msg->result = STORAGE_ERR_GENERIC;
+ msg->result = STORAGE_ERR_SYNC_FAILURE;
return ipc_respond(msg, NULL, 0);
}
}
diff --git a/trusty/storage/proxy/storage.c b/trusty/storage/proxy/storage.c
index 2fedcce6d..c531cfd13 100644
--- a/trusty/storage/proxy/storage.c
+++ b/trusty/storage/proxy/storage.c
@@ -410,7 +410,7 @@ int storage_file_write(struct storage_msg *msg,
if (msg->flags & STORAGE_MSG_FLAG_POST_COMMIT) {
rc = storage_sync_checkpoint();
if (rc < 0) {
- msg->result = STORAGE_ERR_GENERIC;
+ msg->result = STORAGE_ERR_SYNC_FAILURE;
goto err_response;
}
}