From c381c299e1975caa6da747ce0b99d7a7b91baac0 Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Mon, 12 Sep 2022 14:13:38 +0000 Subject: [PATCH] messages: avoid converting ceph errors on Windows libclient and libcephfs return CEPHFS_E* errors, which are basically Linux errno codes. If we convert mds errors to host errno values, we end up mixing error codes. For Windows, we'll preserve the original error value, which is expected to be a Linux (CEPHFS_E*) error. It may be worth doing the same for other platforms eventually. Signed-off-by: Lucian Petrut --- src/messages/MClientReply.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/messages/MClientReply.h b/src/messages/MClientReply.h index 46271c2327d0..51d8754da300 100644 --- a/src/messages/MClientReply.h +++ b/src/messages/MClientReply.h @@ -326,7 +326,18 @@ public: epoch_t get_mdsmap_epoch() const { return head.mdsmap_epoch; } int get_result() const { + #ifdef _WIN32 + // libclient and libcephfs return CEPHFS_E* errors, which are basically + // Linux errno codes. If we convert mds errors to host errno values, we + // end up mixing error codes. + // + // For Windows, we'll preserve the original error value, which is expected + // to be a linux (CEPHFS_E*) error. It may be worth doing the same for + // other platforms. + return head.result; + #else return ceph_to_hostos_errno((__s32)(__u32)head.result); + #endif } void set_result(int r) { head.result = r; } -- 2.47.3