From 9e7475f8fb08b0ef30cad2c0d680cecf331b44ef Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Thu, 12 Oct 2017 08:58:03 -0400 Subject: [PATCH] cls/journal: fixed possible infinite loop which could kill the OSD Fixes: http://tracker.ceph.com/issues/21771 Signed-off-by: Jason Dillaman --- src/cls/journal/cls_journal.cc | 1 + src/test/cls_journal/test_cls_journal.cc | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/cls/journal/cls_journal.cc b/src/cls/journal/cls_journal.cc index 7cc2866586ad8..091fac1feef1a 100644 --- a/src/cls/journal/cls_journal.cc +++ b/src/cls/journal/cls_journal.cc @@ -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) { diff --git a/src/test/cls_journal/test_cls_journal.cc b/src/test/cls_journal/test_cls_journal.cc index 2e1123607752e..d9cdb6b7754f1 100644 --- a/src/test/cls_journal/test_cls_journal.cc +++ b/src/test/cls_journal/test_cls_journal.cc @@ -547,6 +547,14 @@ TEST_F(TestClsJournal, TagList) { ASSERT_EQ(0, client::tag_list(ioctx, oid, "id1", boost::optional(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(), + &tags)); + ASSERT_EQ(expected_all_tags, tags); } TEST_F(TestClsJournal, GuardAppend) { -- 2.39.5