]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: fix Windows block count overflow
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Wed, 27 Jan 2021 08:30:54 +0000 (08:30 +0000)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Wed, 3 Feb 2021 07:17:56 +0000 (07:17 +0000)
rbd-wnbd uses uint32_t for storing the image total block count,
which will overflow for >2TB images that are using 512B blocks.

This patch will switch to a uint64_t.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
src/tools/rbd_wnbd/wnbd_handler.h

index a5c042f58026d900b9b4e5b9da269c86fa737b7a..9a8217745ff5c183fdaeb07fd55c0f1198335afa 100644 (file)
@@ -65,7 +65,7 @@ class WnbdHandler
 private:
   librbd::Image &image;
   std::string instance_name;
-  uint32_t block_count;
+  uint64_t block_count;
   uint32_t block_size;
   bool readonly;
   bool rbd_cache_enabled;
@@ -76,7 +76,7 @@ private:
 
 public:
   WnbdHandler(librbd::Image& _image, std::string _instance_name,
-              uint32_t _block_count, uint32_t _block_size,
+              uint64_t _block_count, uint32_t _block_size,
               bool _readonly, bool _rbd_cache_enabled,
               uint32_t _io_req_workers,
               uint32_t _io_reply_workers)