summaryrefslogtreecommitdiffstats
path: root/src/test/librados_test_stub
diff options
context:
space:
mode:
authorOr Ozeri <oro@il.ibm.com>2020-07-28 11:08:30 +0200
committerOr Ozeri <oro@il.ibm.com>2020-07-29 13:39:08 +0200
commit143be4cc3cb264a125a0272c796a438af281303a (patch)
tree1cac874c7110f2c72e1aeb3586f376c41182afd5 /src/test/librados_test_stub
parentMerge pull request #36157 from rhcs-dashboard/fix-46601-master (diff)
downloadceph-143be4cc3cb264a125a0272c796a438af281303a.tar.xz
ceph-143be4cc3cb264a125a0272c796a438af281303a.zip
test/librados_test_stub: handle exclusive create
The exclusive boolean of the create method was unused so far. This commit adds the proper handling by checking if an object already exists, and returning EEXISTS appropriately. Signed-off-by: Or Ozeri <oro@il.ibm.com>
Diffstat (limited to 'src/test/librados_test_stub')
-rw-r--r--src/test/librados_test_stub/TestMemIoCtxImpl.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/librados_test_stub/TestMemIoCtxImpl.cc b/src/test/librados_test_stub/TestMemIoCtxImpl.cc
index d1f2f8cda51..24b4ac559a3 100644
--- a/src/test/librados_test_stub/TestMemIoCtxImpl.cc
+++ b/src/test/librados_test_stub/TestMemIoCtxImpl.cc
@@ -108,6 +108,13 @@ int TestMemIoCtxImpl::create(const std::string& oid, bool exclusive,
}
std::unique_lock l{m_pool->file_lock};
+ if (exclusive) {
+ TestMemCluster::SharedFile file = get_file(oid, false, CEPH_NOSNAP, {});
+ if (file != NULL && file->exists) {
+ return -EEXIST;
+ }
+ }
+
get_file(oid, true, CEPH_NOSNAP, snapc);
return 0;
}