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 return; } } + +void LogResponseError(const std::string& message, const FuseResponse& response) { + LOG(ERROR) << message << ": header.len=" << response.header.len + << " header.error=" << response.header.error + << " header.unique=" << response.header.unique; +} } class FuseBridgeEntry { @@ -135,6 +141,7 @@ class FuseBridgeEntry { } if (!buffer_.response.Write(device_fd_)) { + LogResponseError("Failed to write a reply from proxy to device", buffer_.response); return FuseBridgeState::kClosing; } @@ -200,6 +207,7 @@ class FuseBridgeEntry { } if (!buffer_.response.Write(device_fd_)) { + LogResponseError("Failed to write a response to device", buffer_.response); return FuseBridgeState::kClosing; } @@ -215,6 +223,11 @@ class FuseBridgeEntry { case ResultOrAgain::kSuccess: return FuseBridgeState::kWaitToReadEither; case ResultOrAgain::kFailure: + LOG(ERROR) << "Failed to write a request to proxy:" + << " header.len=" << buffer_.request.header.len + << " header.opcode=" << buffer_.request.header.opcode + << " header.unique=" << buffer_.request.header.unique + << " header.nodeid=" << buffer_.request.header.nodeid; return FuseBridgeState::kClosing; case ResultOrAgain::kAgain: 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* self, int fd, int sockflag, co case EAGAIN: return ResultOrAgain::kAgain; default: - PLOG(ERROR) << "Failed to write a FUSE message"; + PLOG(ERROR) << "Failed to write a FUSE message: " + << "fd=" << fd << " " + << "sockflag=" << sockflag << " " + << "data=" << data; return ResultOrAgain::kFailure; } }