From: Lucian Petrut Date: Mon, 12 Sep 2022 14:13:38 +0000 (+0000) Subject: messages: avoid converting ceph errors on Windows X-Git-Tag: v18.1.0~369^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c381c299e1975caa6da747ce0b99d7a7b91baac0;p=ceph.git 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 --- 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; }