From: xie xingguo Date: Tue, 6 Dec 2016 04:00:36 +0000 (+0800) Subject: os/bluestore: fix potential csum_order overflow X-Git-Tag: v11.1.1~78^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ef7fdc0a981cae66494d3d34160e2799946ffbde;p=ceph.git os/bluestore: fix potential csum_order overflow Signed-off-by: xie xingguo --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 83e15e7126eb..e0089f28b8e3 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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",