lock_packed_refs(): fix cache validity check