void dec_nlm_owner_ref_locked(state_owner_t *powner) { bool_t remove = FALSE; char str[HASHTABLE_DISPLAY_STRLEN]; if(isFullDebug(COMPONENT_STATE)) display_nlm_owner(powner, str); if(powner->so_refcount > 1) { powner->so_refcount--; LogFullDebug(COMPONENT_STATE, "Decrement refcount for NLM Owner powner=%p {%s}, refcount = %d", powner, str, powner->so_refcount); } else remove = TRUE; V(powner->so_mutex); if(remove) { hash_buffer_t buffkey, old_key, old_value; buffkey.pdata = (caddr_t) powner; buffkey.len = sizeof(*powner); switch(HashTable_DelRef(ht_nlm_owner, &buffkey, &old_key, &old_value, Hash_del_nlm_owner_ref)) { case HASHTABLE_SUCCESS: LogFullDebug(COMPONENT_STATE, "Free NLM Owner powner=%p {%s}, refcount = %d", powner, str, powner->so_refcount); dec_nlm_client_ref(powner->so_owner.so_nlm_owner.so_client); Mem_Free(old_key.pdata); Mem_Free(old_value.pdata); break; case HASHTABLE_NOT_DELETED: /* ref count didn't end up at 0, don't free. */ LogDebug(COMPONENT_STATE, "HashTable_DelRef didn't reduce refcount to 0 for powner=%p {%s}, refcount = %d", powner, str, powner->so_refcount); break; default: /* some problem occurred */ LogDebug(COMPONENT_STATE, "HashTable_DelRef failed for powner=%p {%s}", powner, str); break; } } }
void remove_nfs4_owner(cache_inode_client_t * pclient, state_owner_t * powner, const char * str) { hash_buffer_t buffkey, old_key, old_value; state_nfs4_owner_name_t oname; int rc; oname.son_clientid = powner->so_owner.so_nfs4_owner.so_clientid; oname.son_owner_len = powner->so_owner_len; oname.son_islock = powner->so_type == STATE_LOCK_OWNER_NFSV4; memcpy(oname.son_owner_val, powner->so_owner_val, powner->so_owner_len); buffkey.pdata = (caddr_t) &oname; buffkey.len = sizeof(*powner); rc = HashTable_DelRef(ht_nfs4_owner, &buffkey, &old_key, &old_value, Hash_dec_state_owner_ref); switch(rc) { case HASHTABLE_SUCCESS: if(powner->so_type == STATE_LOCK_OWNER_NFSV4) dec_state_owner_ref(powner->so_owner.so_nfs4_owner.so_related_owner, pclient); /* Release the owner_name (key) and owner (data) back to appropriate pools */ LogFullDebug(COMPONENT_STATE, "Free %s", str); nfs4_Compound_FreeOne(&powner->so_owner.so_nfs4_owner.so_resp); ReleaseToPool(old_value.pdata, &pclient->pool_state_owner); ReleaseToPool(old_key.pdata, &pclient->pool_nfs4_owner_name); break; case HASHTABLE_NOT_DELETED: /* ref count didn't end up at 0, don't free. */ LogDebug(COMPONENT_STATE, "HashTable_DelRef didn't reduce refcount to 0 for %s", str); break; default: /* some problem occurred */ LogDebug(COMPONENT_STATE, "HashTable_DelRef failed (%s) for %s", hash_table_err_to_str(rc), str); break; } }
void remove_nlm_owner(cache_inode_client_t * pclient, state_owner_t * powner, const char * str) { hash_buffer_t buffkey, old_key, old_value; buffkey.pdata = (caddr_t) powner; buffkey.len = sizeof(*powner); switch(HashTable_DelRef(ht_nlm_owner, &buffkey, &old_key, &old_value, Hash_dec_state_owner_ref)) { case HASHTABLE_SUCCESS: LogFullDebug(COMPONENT_STATE, "Free %s size %llx", str, (unsigned long long) old_value.len); dec_nlm_client_ref(powner->so_owner.so_nlm_owner.so_client); if(isFullDebug(COMPONENT_MEMLEAKS)) { memset(old_key.pdata, 0, old_key.len); memset(old_value.pdata, 0, old_value.len); } Mem_Free(old_key.pdata); Mem_Free(old_value.pdata); break; case HASHTABLE_NOT_DELETED: /* ref count didn't end up at 0, don't free. */ LogDebug(COMPONENT_STATE, "HashTable_DelRef didn't reduce refcount to 0 for %s", str); break; default: /* some problem occurred */ LogDebug(COMPONENT_STATE, "HashTable_DelRef failed for %s", str); break; } }
void dec_nlm_client_ref_locked(state_nlm_client_t *pclient) { bool_t remove = FALSE; char str[HASHTABLE_DISPLAY_STRLEN]; if(isFullDebug(COMPONENT_STATE)) display_nlm_client(pclient, str); if(pclient->slc_refcount > 1) { pclient->slc_refcount--; LogFullDebug(COMPONENT_STATE, "Decrement refcount NLM Client {%s}", str); } else remove = TRUE; V(pclient->slc_mutex); if(remove) { hash_buffer_t buffkey, old_key, old_value; buffkey.pdata = (caddr_t) pclient; buffkey.len = sizeof(*pclient); switch(HashTable_DelRef(ht_nlm_client, &buffkey, &old_key, &old_value, Hash_dec_nlm_client_ref)) { case HASHTABLE_SUCCESS: LogFullDebug(COMPONENT_STATE, "Free NLM Client {%s} size %llx", str, (unsigned long long) old_value.len); if(pclient->slc_callback_clnt != NULL) Clnt_destroy(pclient->slc_callback_clnt); dec_nsm_client_ref(pclient->slc_nsm_client); if(isFullDebug(COMPONENT_MEMLEAKS)) { memset(old_key.pdata, 0, old_key.len); memset(old_value.pdata, 0, old_value.len); } Mem_Free(old_key.pdata); Mem_Free(old_value.pdata); break; case HASHTABLE_NOT_DELETED: /* ref count didn't end up at 0, don't free. */ LogDebug(COMPONENT_STATE, "HashTable_DelRef didn't reduce refcount to 0 for NLM Client {%s}", str); break; default: /* some problem occurred */ LogDebug(COMPONENT_STATE, "HashTable_DelRef failed for NLM Client {%s}", str); break; } } }