Skip to content

Commit

Permalink
common: fix issues with bl::append_zero after killing append_buffer.
Browse files Browse the repository at this point in the history
```
Thread 83 "ms_dispatch" hit Hardware watchpoint 4: *0x555560aaa03a

Old value = 538
New value = 0
__memset_avx2 () at ../sysdeps/x86_64/multiarch/memset-avx2.S:136
136     ../sysdeps/x86_64/multiarch/memset-avx2.S: No such file or directory.
(gdb) bt
 #0  __memset_avx2 () at ../sysdeps/x86_64/multiarch/memset-avx2.S:136
 #1  0x00005555562e0383 in memset (__len=3934, __ch=0, __dest=<optimized out>) at /usr/include/x86_64-linux-gnu/bits/string3.h:90
 #2  ceph::buffer::ptr::append_zeros (this=this@entry=0x5555608db8a0, l=l@entry=3934) at /work/ceph-4/src/common/buffer.cc:780
 ceph#3  0x00005555562e426d in ceph::buffer::list::append_zero (this=0x7fffe2db22b0, len=<optimized out>) at /work/ceph-4/src/common/buffer.cc:1740
 ceph#4  0x0000555555f47e29 in BlueStore::_apply_padding (this=0x55556059c000, head_pad=0, tail_pad=4038, padded=...) at /work/ceph-4/src/os/bluestore/BlueStore.cc:12595
 ceph#5  0x0000555555f49414 in BlueStore::_do_write_small (this=0x55556059c000, txc=0x555560779200, c=..., o=..., offset=0, length=58, blp=..., wctx=0x7fffe2db24e0)
     at /work/ceph-4/src/os/bluestore/BlueStore.cc:10560
 ceph#6  0x0000555555f4b4ba in BlueStore::_do_write_data (this=0x55556059c000, txc=0x555560779200, c=..., o=..., offset=0, length=58, bl=..., wctx=0x7fffe2db24e0)
     at /work/ceph-4/src/os/bluestore/BlueStore.cc:11157
 ceph#7  0x0000555555f4c0e7 in BlueStore::_do_write (this=0x55556059c000, txc=0x555560779200, c=..., o=..., offset=0, length=58, bl=..., fadvise_flags=0) at /work/ceph-4/src/os/bluestore/BlueStore.cc:11375
 ceph#8  0x0000555555f4ce5b in BlueStore::_write (this=0x55556059c000, txc=0x555560779200, c=..., o=..., offset=0, length=58, bl=..., fadvise_flags=0) at /work/ceph-4/src/os/bluestore/BlueStore.cc:11436
 ceph#9  0x0000555555f513e9 in BlueStore::_txc_add_transaction (this=<optimized out>, txc=<optimized out>, t=<optimized out>) at /work/ceph-4/src/os/bluestore/BlueStore.cc:10047
 ceph#10 0x0000555555f54b26 in BlueStore::queue_transactions (this=0x55556059c000, ch=..., tls=std::vector of length 1, capacity 1 = {...}, op=..., handle=0x0) at /work/ceph-4/src/os/bluestore/BlueStore.cc:9824
 ceph#11 0x0000555555b2f932 in ObjectStore::queue_transaction(boost::intrusive_ptr<ObjectStore::CollectionImpl>&, ObjectStore::Transaction&&, boost::intrusive_ptr<TrackedOp>, ThreadPool::TPHandle*) (
     this=0x55556059c000, ch=..., t=<optimized out>, op=..., handle=0x0) at /work/ceph-4/src/os/ObjectStore.h:1491
 ceph#12 0x0000555555ad07a8 in OSD::handle_osd_map (this=0x555560744000, m=<optimized out>) at /work/ceph-4/src/osd/OSD.cc:7640
 ceph#13 0x0000555555aded81 in OSD::_dispatch (this=0x555560744000, m=0x55555f74ec00) at /work/ceph-4/src/osd/OSD.cc:6876
 ceph#14 0x0000555555adf128 in OSD::ms_dispatch (this=0x555560744000, m=0x55555f74ec00) at /work/ceph-4/src/osd/OSD.cc:6555
 ceph#15 0x000055555640a45a in Dispatcher::ms_dispatch2 (m=..., this=0x555560744000) at /work/ceph-4/src/msg/Dispatcher.h:125
 ceph#16 Messenger::ms_deliver_dispatch (m=..., this=0x5555605c9800) at /work/ceph-4/src/msg/Messenger.h:642
 ceph#17 DispatchQueue::entry (this=0x5555605c9a10) at /work/ceph-4/src/msg/DispatchQueue.cc:196
 ceph#18 0x00005555562a61bd in DispatchQueue::DispatchThread::entry (this=<optimized out>) at /work/ceph-4/src/msg/DispatchQueue.h:102
 ceph#19 0x00007ffff58476ba in start_thread (arg=0x7fffe2db7700) at pthread_create.c:333
 ceph#20 0x00007ffff48af41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
```

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
  • Loading branch information
rzarzynski committed Oct 22, 2018
1 parent f372931 commit 6255f5a
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/common/buffer.cc
Expand Up @@ -1716,23 +1716,19 @@ using namespace ceph;

void buffer::list::append_zero(unsigned len)
{
if (_buffers.empty()) {
auto& buf = hangable_ptr::create(buffer::create_page_aligned(len));
buf.set_length(0); // unused, so far.
_buffers.push_back(buf);
}
_len += len;

auto& buf = _buffers.back();
unsigned need = std::min(buf.unused_tail_length(), len);
if (need) {
buf.append_zeros(need);
len -= need;
_len += need;
const unsigned free_in_last = get_append_buffer_unused_tail_length();
const unsigned first_round = std::min(len, free_in_last);
if (first_round) {
_buffers.back().append_zeros(first_round);
}
if (len) {
auto& bp = hangable_ptr::create(buffer::create_page_aligned(len));
bp.zero(false);
push_back(std::move(bp));

const unsigned second_round = len - first_round;
if (second_round) {
auto& new_back = refill_append_space(second_round);
new_back.set_length(second_round);
new_back.zero(false);
}
}

Expand Down

0 comments on commit 6255f5a

Please sign in to comment.