Skip to content

Commit

Permalink
os/bluestore: fix potential csum_order overflow
Browse files Browse the repository at this point in the history
Signed-off-by: xie xingguo <[email protected]>
  • Loading branch information
xiexingguo committed Dec 6, 2016
1 parent dded3de commit ef7fdc0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/os/bluestore/BlueStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit ef7fdc0

Please sign in to comment.