Skip to content

Commit 8bcd0cf

Browse files
igchorbyrnedj
authored andcommitted
Insert the child to MMContainer after incrementing
the ref count. This is to avoid incRef failing in case the item is selected for eviction/slab release.
1 parent bebb2fa commit 8bcd0cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cachelib/allocator/CacheAllocator-inl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,15 +591,15 @@ void CacheAllocator<CacheTrait>::addChainedItem(WriteHandle& parent,
591591
// Count a new child
592592
stats_.numChainedChildItems.inc();
593593

594-
insertInMMContainer(*child);
595-
596594
// Increment refcount since this chained item is now owned by the parent
597595
// Parent will decrement the refcount upon release. Since this is an
598596
// internal refcount, we dont include it in active handle tracking.
599597
auto ret = child->incRef(true);
600598
XDCHECK(ret == RefcountWithFlags::incResult::incOk);
601599
XDCHECK_EQ(2u, child->getRefCount());
602600

601+
insertInMMContainer(*child);
602+
603603
invalidateNvm(*parent);
604604
if (auto eventTracker = getEventTracker()) {
605605
eventTracker->record(AllocatorApiEvent::ADD_CHAINED, parent->getKey(),

0 commit comments

Comments
 (0)