]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: fix insert empty ptr when bufferlist rebuild
authorXinze Chi <xmdxcxz@gmail.com>
Mon, 24 Aug 2015 15:01:27 +0000 (23:01 +0800)
committerXinze Chi <xmdxcxz@gmail.com>
Wed, 26 Aug 2015 01:54:01 +0000 (09:54 +0800)
Fixes: #12775
Signed-off-by: Xinze Chi <xmdxcxz@gmail.com>
src/common/buffer.cc

index 051137e0178a829afc5d8d5707e82dca7705b88d..f1b203524f08bece3ea42aa315455207b82e026b 100644 (file)
@@ -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();
   }