From 047ad0ba84b293b666344269c7a666477fdcc3c0 Mon Sep 17 00:00:00 2001 From: "Yan, Zheng" Date: Thu, 5 Dec 2019 10:16:27 +0800 Subject: [PATCH] mds: fix assert(omap_num_objs <= MAX_OBJECTS) of OpenFileTable 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" (cherry picked from commit 21b1069eab43fdc2c91915d22f45802d017702fc) --- src/mds/OpenFileTable.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mds/OpenFileTable.cc b/src/mds/OpenFileTable.cc index c0f72d581d237..a9b12cd3e549d 100644 --- a/src/mds/OpenFileTable.cc +++ b/src/mds/OpenFileTable.cc @@ -465,8 +465,10 @@ void OpenFileTable::commit(MDSInternalContextBase *c, uint64_t log_seq, int op_p 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; -- 2.39.5