Fix reference counting in get_attached_entry

When get_attached_entry() encounters entry that would be expired, it needs to get reference to the entry before calling maybe_expire_entry(), so the ADB entry doesn't get destroyed inside the its own lock.

Closes #3712 (closed)

Merge request reports