]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: Transction::append SHOULD NOT modify other.op_bl
authorDong Yuan <yuandong1222@gmail.com>
Tue, 20 Jan 2015 10:44:21 +0000 (10:44 +0000)
committerSamuel Just <sjust@redhat.com>
Tue, 20 Jan 2015 21:17:24 +0000 (13:17 -0800)
the other.op_bl SHOULD NOT be changes during append operation,
we use additional bufferlist to avoid this problem

Change-Id: I5d4a8c9ed3d0b926ca4bbdcdadf72cb4d5fde53c
Signed-off-by: Dong Yuan <yuandong1222@gmail.com>
src/os/ObjectStore.h

index 70f8d0f2bf3fd705f3e8e4e067cff338b67ace07..179665ec5aa4b19035e4b072f4a2c285f8b581b1 100644 (file)
@@ -665,16 +665,23 @@ public:
            object_index_p != other.object_index.end();
            object_index_p++) {
         om[object_index_p->second] = _get_object_id(object_index_p->first);
-      }
+      }      
+
+      //the other.op_bl SHOULD NOT be changes during append operation,
+      //we use additional bufferlist to avoid this problem
+      bufferptr other_op_bl_ptr(other.op_bl.length());
+      other.op_bl.copy(0, other.op_bl.length(), other_op_bl_ptr.c_str());
+      bufferlist other_op_bl;
+      other_op_bl.append(other_op_bl_ptr);
 
-      //update other.op_bl with cm & om
+      //update other_op_bl with cm & om
       //When the other is appended to current transaction, all coll_index and
       //object_index in other.op_buffer should be updated by new index of the
       //combined transaction
-      _update_op_bl(other.op_bl, cm, om);
+      _update_op_bl(other_op_bl, cm, om);
 
       //append op_bl
-      op_bl.append(other.op_bl);
+      op_bl.append(other_op_bl);
       //append data_bl
       data_bl.append(other.data_bl);
     }