]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
messages: avoid converting ceph errors on Windows
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Mon, 12 Sep 2022 14:13:38 +0000 (14:13 +0000)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Thu, 10 Nov 2022 07:38:14 +0000 (09:38 +0200)
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 <lpetrut@cloudbasesolutions.com>
src/messages/MClientReply.h

index 46271c2327d0ee5b1c2fa0b40b2404d1ee091b0e..51d8754da300fb365aa89e92a85642bd4fe9136a 100644 (file)
@@ -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; }