From: Xinze Chi Date: Mon, 24 Aug 2015 15:01:27 +0000 (+0800) Subject: common: fix insert empty ptr when bufferlist rebuild X-Git-Tag: v9.1.0~279^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fb1b6ddd7bfe40d4a38d5ec59b1c3f59f2a83f23;p=ceph.git common: fix insert empty ptr when bufferlist rebuild Fixes: #12775 Signed-off-by: Xinze Chi --- diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 051137e0178a..f1b203524f08 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -1375,6 +1375,10 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; void buffer::list::rebuild() { + if (_len == 0) { + _buffers.clear(); + return; + } ptr nb; if ((_len & ~CEPH_PAGE_MASK) == 0) nb = buffer::create_page_aligned(_len); @@ -1394,7 +1398,8 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; } _memcopy_count += pos; _buffers.clear(); - _buffers.push_back(nb); + if (nb.length()) + _buffers.push_back(nb); invalidate_crc(); }