From 549a335fad23a351a9ff4984dcc834641c6ad5ab Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 17 Dec 2015 11:27:03 -0500 Subject: [PATCH] ceph_test_objectstore: fix clone Copy the buffer, in case other threads modify it in place. Signed-off-by: Sage Weil --- src/test/objectstore/store_test.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 9da4c7ed50e70..771f5bfe5e174 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -1471,7 +1471,11 @@ public: ++in_flight; in_flight_objects.insert(old_obj); - contents[new_obj] = contents[old_obj]; + // *copy* the data buffer, since we may modify it later. + contents[new_obj].attrs = contents[old_obj].attrs; + contents[new_obj].data.clear(); + contents[new_obj].data.append(contents[old_obj].data.c_str(), + contents[old_obj].data.length()); return store->queue_transaction(osr, t, new C_SyntheticOnClone(this, t, old_obj, new_obj)); } -- 2.39.5