]> git.apps.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)
committerLoic Dachary <ldachary@redhat.com>
Wed, 2 Sep 2015 19:23:40 +0000 (21:23 +0200)
Fixes: #12775
Signed-off-by: Xinze Chi <xmdxcxz@gmail.com>
(cherry picked from commit fb1b6ddd7bfe40d4a38d5ec59b1c3f59f2a83f23)

Conflicts:
src/common/buffer.cc : because invalidate_crc did not exist
        in hammer

src/common/buffer.cc

index 2a91ec34bf84d3958555a986a2f12cc6d2344c79..c1a39cc3e34defbfc086f44f2c92e061c9cb50e8 100644 (file)
@@ -1206,6 +1206,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);
@@ -1225,7 +1229,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);
   }
 
 void buffer::list::rebuild_aligned(unsigned align)