]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix assert(omap_num_objs <= MAX_OBJECTS) of OpenFileTable 32020/head
authorYan, Zheng <zyan@redhat.com>
Thu, 5 Dec 2019 02:16:27 +0000 (10:16 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 10 Dec 2019 12:15:12 +0000 (20:15 +0800)
Current behavior of the loop that commits dirty items is:

- If the last object is not full, it will be chosen for new item.
- If the last object becomes full, a new object is allocated, which
  becomes the new last object.

Above logical can make object count increase even there is free object.

Fixes: https://tracker.ceph.com/issues/36094
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/OpenFileTable.cc

index 0f354ff5a3b93ba2912ddd6947a84b6207e7d57e..4c79cca9a5809f920c985ead679d962bc7a3736b 100644 (file)
@@ -465,8 +465,10 @@ void OpenFileTable::commit(MDSContext *c, uint64_t log_seq, int op_prio)
        ceph_assert(it.second == DIRTY_NEW);
        // find omap object to store the key
        for (unsigned i = first_free_idx; i < omap_num_objs; i++) {
-         if (omap_num_items[i] < MAX_ITEMS_PER_OBJ)
+         if (omap_num_items[i] < MAX_ITEMS_PER_OBJ) {
            omap_idx = i;
+           break;
+         }
        }
        if (omap_idx < 0) {
          ++omap_num_objs;