From: Dong Yuan Date: Tue, 20 Jan 2015 10:44:21 +0000 (+0000) Subject: osd: Transction::append SHOULD NOT modify other.op_bl X-Git-Tag: v0.93~214^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=46347fccc12444607f8940aca1ef0a0b6b7f1845;p=ceph.git osd: Transction::append SHOULD NOT modify other.op_bl 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 --- diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 70f8d0f2bf3fd..179665ec5aa4b 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -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); }