Skip to content
Permalink
Browse files

Merge pull request #27366 from ifed01/wip-ifed-fix-alloc-overflow-mimic

mimic: os/bluestore: fix length overflow.

Reviewed-by: Jianpeng Ma <jianpeng.ma@intel.com>
Reviewed-by: Neha Ojha <nojha@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information...
yuriw committed May 1, 2019
2 parents 4eac53d + 7ebd14c commit f71eb0f8d24b300cd041a14b1251683899319e48
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/os/bluestore/fastbmap_allocator_impl.h
@@ -407,10 +407,10 @@ class AllocatorLevel01Loose : public AllocatorLevel01
uint64_t* allocated,
interval_vector_t* res);

uint64_t _mark_alloc_l1(const interval_t& r)
uint64_t _mark_alloc_l1(uint64_t offset, uint64_t length)
{
uint64_t l0_pos_start = r.offset / l0_granularity;
uint64_t l0_pos_end = p2roundup(r.offset + r.length, l0_granularity) / l0_granularity;
uint64_t l0_pos_start = offset / l0_granularity;
uint64_t l0_pos_end = p2roundup(offset + length, l0_granularity) / l0_granularity;
_mark_alloc_l1_l0(l0_pos_start, l0_pos_end);
return l0_granularity * (l0_pos_end - l0_pos_start);
}
@@ -745,7 +745,7 @@ class AllocatorLevel02 : public AllocatorLevel
uint64_t l2_pos_end = p2roundup(int64_t(o + len), int64_t(l2_granularity)) / l2_granularity;

std::lock_guard<std::mutex> l(lock);
auto allocated = l1._mark_alloc_l1(interval_t(o, len));
auto allocated = l1._mark_alloc_l1(o, len);
assert(available >= allocated);
available -= allocated;
_mark_l2_on_l1(l2_pos, l2_pos_end);

0 comments on commit f71eb0f

Please sign in to comment.
You can’t perform that action at this time.