Merge pull request #18270 from dillaman/wip-21391

cls/journal: possible infinite loop within tag_list class method

Reviewed-by: Mykola Golub <to.my.trociny@gmail.com>
This commit is contained in:
Mykola Golub 2017-10-12 22:39:55 +03:00 committed by GitHub
commit 914c99717e
4 changed files with 28 additions and 0 deletions

View File

@ -1047,6 +1047,7 @@ int journal_tag_list(cls_method_context_t hctx, bufferlist *in,
// completed calculation of tag class minimums
if (tag.tid >= minimum_tag_tid) {
vals.clear();
more = false;
break;
}
} else if (tag_pass == TAG_PASS_LIST) {

View File

@ -14,6 +14,7 @@ add_subdirectory(cls_log)
add_subdirectory(cls_numops)
add_subdirectory(cls_sdk)
if(WITH_RBD)
add_subdirectory(cls_journal)
add_subdirectory(cls_rbd)
endif(WITH_RBD)
add_subdirectory(cls_refcount)

View File

@ -0,0 +1,18 @@
# cls_test_cls_journal
add_executable(ceph_test_cls_journal
test_cls_journal.cc
$<TARGET_OBJECTS:common_texttable_obj>)
set_target_properties(ceph_test_cls_journal PROPERTIES COMPILE_FLAGS
${UNITTEST_CXX_FLAGS})
target_link_libraries(ceph_test_cls_journal
cls_journal_client
librados
global
${UNITTEST_LIBS}
${CMAKE_DL_LIBS}
${CRYPTO_LIBS}
${EXTRALIBS}
radostest)
install(TARGETS
ceph_test_cls_journal
DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@ -547,6 +547,14 @@ TEST_F(TestClsJournal, TagList) {
ASSERT_EQ(0, client::tag_list(ioctx, oid, "id1", boost::optional<uint64_t>(0),
&tags));
ASSERT_EQ(expected_filtered_tags, tags);
librados::ObjectWriteOperation op1;
client::client_commit(&op1, "id1", {{{96, 0, 120}}});
ASSERT_EQ(0, ioctx.operate(oid, &op1));
ASSERT_EQ(0, client::tag_list(ioctx, oid, "id1", boost::optional<uint64_t>(),
&tags));
ASSERT_EQ(expected_all_tags, tags);
}
TEST_F(TestClsJournal, GuardAppend) {