]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: fix potential csum_order overflow
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 6 Dec 2016 04:00:36 +0000 (12:00 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 6 Dec 2016 04:00:36 +0000 (12:00 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/bluestore/BlueStore.cc

index 83e15e7126eb2439069f2663aa18d8b59af4550c..e0089f28b8e302373a3f54a5fd804a429b37df12 100644 (file)
@@ -8064,8 +8064,13 @@ int BlueStore::_do_write(
                        CEPH_OSD_ALLOC_HINT_FLAG_APPEND_ONLY)) &&
       (alloc_hints & CEPH_OSD_ALLOC_HINT_FLAG_RANDOM_WRITE) == 0) {
     dout(20) << __func__ << " will prefer large blob and csum sizes" << dendl;
-    wctx.csum_order = std::max(min_alloc_size_order,
-                              (size_t)ctzl(o->onode.expected_write_size));
+    if (o->onode.expected_write_size) {
+      wctx.csum_order = std::max(min_alloc_size_order,
+                                (size_t)ctzl(o->onode.expected_write_size));
+    } else {
+      wctx.csum_order = min_alloc_size_order;
+    }
+
     if (wctx.compress) {
       wctx.target_blob_size = select_option(
         "compression_max_blob_size",