summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaichi Hirono2017-06-08 23:12:21 -0500
committerDaichi Hirono2017-06-11 20:37:08 -0500
commite5a1556d402789dc02aa041c8d04d0b23a0ce68e (patch)
treeaaee25a43666860c95eba19a4442516f9b682002 /libappfuse
parent435baf5d00162b6f14ada5f243ae49c62714d03f (diff)
downloadplatform-system-core-e5a1556d402789dc02aa041c8d04d0b23a0ce68e.tar.gz
platform-system-core-e5a1556d402789dc02aa041c8d04d0b23a0ce68e.tar.xz
platform-system-core-e5a1556d402789dc02aa041c8d04d0b23a0ce68e.zip
Add more logs for writing failures.
Bug: 62429763 Test: libappfuse_test Change-Id: Ie0eabd09ae9ad3f8ba8c4f38f871dad16b5c58ff
Diffstat (limited to 'libappfuse')
-rw-r--r--libappfuse/FuseBridgeLoop.cc13
-rw-r--r--libappfuse/FuseBuffer.cc5
2 files changed, 17 insertions, 1 deletions
diff --git a/libappfuse/FuseBridgeLoop.cc b/libappfuse/FuseBridgeLoop.cc
index 3f47066a8..07923071b 100644
--- a/libappfuse/FuseBridgeLoop.cc
+++ b/libappfuse/FuseBridgeLoop.cc
@@ -57,6 +57,12 @@ void GetObservedEvents(FuseBridgeState state, int* device_events, int* proxy_eve
57 return; 57 return;
58 } 58 }
59} 59}
60
61void LogResponseError(const std::string& message, const FuseResponse& response) {
62 LOG(ERROR) << message << ": header.len=" << response.header.len
63 << " header.error=" << response.header.error
64 << " header.unique=" << response.header.unique;
65}
60} 66}
61 67
62class FuseBridgeEntry { 68class FuseBridgeEntry {
@@ -135,6 +141,7 @@ class FuseBridgeEntry {
135 } 141 }
136 142
137 if (!buffer_.response.Write(device_fd_)) { 143 if (!buffer_.response.Write(device_fd_)) {
144 LogResponseError("Failed to write a reply from proxy to device", buffer_.response);
138 return FuseBridgeState::kClosing; 145 return FuseBridgeState::kClosing;
139 } 146 }
140 147
@@ -200,6 +207,7 @@ class FuseBridgeEntry {
200 } 207 }
201 208
202 if (!buffer_.response.Write(device_fd_)) { 209 if (!buffer_.response.Write(device_fd_)) {
210 LogResponseError("Failed to write a response to device", buffer_.response);
203 return FuseBridgeState::kClosing; 211 return FuseBridgeState::kClosing;
204 } 212 }
205 213
@@ -215,6 +223,11 @@ class FuseBridgeEntry {
215 case ResultOrAgain::kSuccess: 223 case ResultOrAgain::kSuccess:
216 return FuseBridgeState::kWaitToReadEither; 224 return FuseBridgeState::kWaitToReadEither;
217 case ResultOrAgain::kFailure: 225 case ResultOrAgain::kFailure:
226 LOG(ERROR) << "Failed to write a request to proxy:"
227 << " header.len=" << buffer_.request.header.len
228 << " header.opcode=" << buffer_.request.header.opcode
229 << " header.unique=" << buffer_.request.header.unique
230 << " header.nodeid=" << buffer_.request.header.nodeid;
218 return FuseBridgeState::kClosing; 231 return FuseBridgeState::kClosing;
219 case ResultOrAgain::kAgain: 232 case ResultOrAgain::kAgain:
220 return FuseBridgeState::kWaitToWriteProxy; 233 return FuseBridgeState::kWaitToWriteProxy;
diff --git a/libappfuse/FuseBuffer.cc b/libappfuse/FuseBuffer.cc
index 653e96b28..1b47e0a35 100644
--- a/libappfuse/FuseBuffer.cc
+++ b/libappfuse/FuseBuffer.cc
@@ -115,7 +115,10 @@ ResultOrAgain WriteInternal(const FuseMessage<T>* self, int fd, int sockflag, co
115 case EAGAIN: 115 case EAGAIN:
116 return ResultOrAgain::kAgain; 116 return ResultOrAgain::kAgain;
117 default: 117 default:
118 PLOG(ERROR) << "Failed to write a FUSE message"; 118 PLOG(ERROR) << "Failed to write a FUSE message: "
119 << "fd=" << fd << " "
120 << "sockflag=" << sockflag << " "
121 << "data=" << data;
119 return ResultOrAgain::kFailure; 122 return ResultOrAgain::kFailure;
120 } 123 }
121 } 124 }