namecache: cleanup name_cache_entry_update()

added goto out on attr_cache_find_or_create() failure to avoid calling name_cache_entry_updated()

Signed-off-by: Casey Bodley <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2011-08-26 12:27:46 -04:00 committed by unknown
parent a4b39031b9
commit ead5bc78a2

View file

@ -502,30 +502,32 @@ static int name_cache_entry_update(
entry->fh.len = 0; entry->fh.len = 0;
if (info) { if (info) {
/* negative -> positive entry, create the attributes */ if (entry->attributes == NULL) {
if (entry->attributes == NULL) /* negative -> positive entry, create the attributes */
status = attr_cache_find_or_create(&cache->attributes, status = attr_cache_find_or_create(&cache->attributes,
info->fileid, &entry->attributes); info->fileid, &entry->attributes);
if (status)
if (status == NO_ERROR) { goto out;
attr_cache_update(entry->attributes, info, delegation);
/* hold a reference as long as we have the delegation */
if (is_delegation(delegation)) {
attr_cache_entry_ref(&cache->attributes, entry->attributes);
cache->delegations++;
}
/* keep the entry from expiring */
if (entry->attributes->delegated)
list_remove(&entry->exp_entry);
} }
attr_cache_update(entry->attributes, info, delegation);
/* hold a reference as long as we have the delegation */
if (is_delegation(delegation)) {
attr_cache_entry_ref(&cache->attributes, entry->attributes);
cache->delegations++;
}
/* keep the entry from expiring */
if (entry->attributes->delegated)
list_remove(&entry->exp_entry);
} else if (entry->attributes) { } else if (entry->attributes) {
/* positive -> negative entry, deref the attributes */ /* positive -> negative entry, deref the attributes */
attr_cache_entry_deref(&cache->attributes, entry->attributes); attr_cache_entry_deref(&cache->attributes, entry->attributes);
entry->attributes = NULL; entry->attributes = NULL;
} }
name_cache_entry_updated(cache, entry); name_cache_entry_updated(cache, entry);
out:
return status; return status;
} }