adbname);
INSIST(result == ISC_R_SUCCESS);
+ dns_adbname_ref(adbname);
LOCK(&adbname->lock); /* Must be unlocked by the caller */
adbname->last_used = now;
ISC_LIST_PREPEND(adb->names_lru, adbname, link);
break;
case ISC_R_SUCCESS:
+ dns_adbname_ref(adbname);
LOCK(&adbname->lock); /* Must be unlocked by the caller */
if (adbname->last_used + ADB_CACHE_MINIMUM <= last_update) {
adbname->last_used = now;
UNREACHABLE();
}
- dns_adbname_ref(adbname);
/*
* The refcount is now 2 and the final detach will happen in
* expire_name() - the unused adbname stored in the hashtable and lru
sizeof(adbentry->sockaddr), adbentry);
INSIST(result == ISC_R_SUCCESS);
+ dns_adbentry_ref(adbentry);
LOCK(&adbentry->lock); /* Must be unlocked by the caller */
adbentry->last_used = now;
break;
}
case ISC_R_SUCCESS:
+ /*
+ * The dns_adbentry_ref() must stay here before trying to expire
+ * the ADB entry, so it is not destroyed under the lock.
+ */
+ dns_adbentry_ref(adbentry);
LOCK(&adbentry->lock); /* Must be unlocked by the caller */
if (maybe_expire_entry(adbentry, now)) {
UNLOCK(&adbentry->lock);
UNREACHABLE();
}
- dns_adbentry_ref(adbentry);
-
UNLOCK(&adb->entries_lock);
return (adbentry);