mirror of
https://github.com/ceph/ceph
synced 2024-12-26 05:25:09 +00:00
common: bit_vector extent calculation incorrect for last page
It's highly probable that the last page in the bit vector will not be a full page size. As a result, the computed extents will extend beyond the data portion of the bit vector, resulting in a end_of_buffer exception. Fixes: #12611 Backport: hammer Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
parent
e35d27fc69
commit
c6d9899269
@ -261,7 +261,10 @@ void BitVector<_b>::get_data_extents(uint64_t offset, uint64_t length,
|
||||
end_offset += (CEPH_PAGE_SIZE - (end_offset % CEPH_PAGE_SIZE));
|
||||
assert(*byte_offset <= end_offset);
|
||||
|
||||
*byte_length = MIN(end_offset - *byte_offset, m_data.length());
|
||||
*byte_length = end_offset - *byte_offset;
|
||||
if (*byte_offset + *byte_length > m_data.length()) {
|
||||
*byte_length = m_data.length() - *byte_offset;
|
||||
}
|
||||
}
|
||||
|
||||
template <uint8_t _b>
|
||||
|
Loading…
Reference in New Issue
Block a user