From: Yan, Zheng Date: Thu, 5 Dec 2019 02:16:27 +0000 (+0800) Subject: mds: fix assert(omap_num_objs <= MAX_OBJECTS) of OpenFileTable X-Git-Tag: v14.2.8~44^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4802061055d676fb8b98cb03a3e441b3537acfc0;p=ceph.git 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) --- diff --git a/src/mds/OpenFileTable.cc b/src/mds/OpenFileTable.cc index 323069db9319..5e0d2ba53dab 100644 --- a/src/mds/OpenFileTable.cc +++ b/src/mds/OpenFileTable.cc @@ -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;