Skip to content

Commit

Permalink
Merge pull request #18626 from dillaman/wip-21968
Browse files Browse the repository at this point in the history
luminous: cls/journal: fixed possible infinite loop in expire_tags

Reviewed-By: Mykola Golub <trociny@gmail.com>
  • Loading branch information
theanalyst committed Nov 7, 2017
2 parents bc9f508 + c2237c7 commit 14e0530
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions qa/suites/rbd/basic/tasks/rbd_cls_tests.yaml
Expand Up @@ -3,3 +3,5 @@ tasks:
clients:
client.0:
- cls/test_cls_rbd.sh
- cls/test_cls_lock.sh
- cls/test_cls_journal.sh
6 changes: 6 additions & 0 deletions qa/workunits/cls/test_cls_journal.sh
@@ -0,0 +1,6 @@
#!/bin/sh -e

GTEST_FILTER=${CLS_JOURNAL_GTEST_FILTER:-*}
ceph_test_cls_journal --gtest_filter=${GTEST_FILTER}

exit 0
1 change: 1 addition & 0 deletions src/cls/journal/cls_journal.cc
Expand Up @@ -188,6 +188,7 @@ int expire_tags(cls_method_context_t hctx, const std::string *skip_client_id) {
if (tag.tid >= minimum_tag_tid) {
// no need to check for tag classes beyond this point
vals.clear();
more = false;
break;
}
}
Expand Down
12 changes: 9 additions & 3 deletions src/test/cls_journal/test_cls_journal.cc
Expand Up @@ -322,15 +322,21 @@ TEST_F(TestClsJournal, ClientUnregisterPruneTags) {
bufferlist()));
ASSERT_EQ(0, client::tag_create(ioctx, oid, 1, Tag::TAG_CLASS_NEW,
bufferlist()));
ASSERT_EQ(0, client::tag_create(ioctx, oid, 2, 1, bufferlist()));

for (uint32_t i = 2; i <= 96; ++i) {
ASSERT_EQ(0, client::tag_create(ioctx, oid, i, 1, bufferlist()));
}

librados::ObjectWriteOperation op1;
client::client_commit(&op1, "id1", {{{1, 2, 120}}});
client::client_commit(&op1, "id1", {{{1, 32, 120}}});
ASSERT_EQ(0, ioctx.operate(oid, &op1));

ASSERT_EQ(0, client::client_unregister(ioctx, oid, "id2"));

std::set<Tag> expected_tags = {{0, 0, {}}, {2, 1, {}}};
std::set<Tag> expected_tags = {{0, 0, {}}};
for (uint32_t i = 32; i <= 96; ++i) {
expected_tags.insert({i, 1, {}});
}
std::set<Tag> tags;
ASSERT_EQ(0, client::tag_list(ioctx, oid, "id1",
boost::optional<uint64_t>(), &tags));
Expand Down

0 comments on commit 14e0530

Please sign in to comment.