From: Mykola Golub Date: Tue, 27 Mar 2018 18:27:50 +0000 (+0300) Subject: test/librados_test_stub: always create copy of buffers passed to operation X-Git-Tag: v13.1.0~448^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9ecd4680d2c99eef1bdb489c9b4241863ac838a0;p=ceph.git test/librados_test_stub: always create copy of buffers passed to operation Otherwise the buffers may be shared between object files if the same bufferlist was passed to several operations (append and write_full were affected). Signed-off-by: Mykola Golub --- diff --git a/src/test/librados_test_stub/TestMemIoCtxImpl.cc b/src/test/librados_test_stub/TestMemIoCtxImpl.cc index cc99b1ee710c..ca2d2cd3108f 100644 --- a/src/test/librados_test_stub/TestMemIoCtxImpl.cc +++ b/src/test/librados_test_stub/TestMemIoCtxImpl.cc @@ -69,7 +69,9 @@ int TestMemIoCtxImpl::append(const std::string& oid, const bufferlist &bl, } RWLock::WLocker l(file->lock); - file->data.append(bl); + auto off = file->data.length(); + ensure_minimum_length(off + bl.length(), &file->data); + file->data.copy_in(off, bl.length(), bl); return 0; } @@ -579,7 +581,8 @@ int TestMemIoCtxImpl::write_full(const std::string& oid, bufferlist& bl, } file->data.clear(); - file->data.append(bl); + ensure_minimum_length(bl.length(), &file->data); + file->data.copy_in(0, bl.length(), bl); return 0; }