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,12 +502,14 @@ static int name_cache_entry_update(
entry->fh.len = 0; entry->fh.len = 0;
if (info) { if (info) {
if (entry->attributes == NULL) {
/* negative -> positive entry, create the attributes */ /* negative -> positive entry, create the attributes */
if (entry->attributes == NULL)
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)
goto out;
}
if (status == NO_ERROR) {
attr_cache_update(entry->attributes, info, delegation); attr_cache_update(entry->attributes, info, delegation);
/* hold a reference as long as we have the delegation */ /* hold a reference as long as we have the delegation */
@ -519,13 +521,13 @@ static int name_cache_entry_update(
/* keep the entry from expiring */ /* keep the entry from expiring */
if (entry->attributes->delegated) if (entry->attributes->delegated)
list_remove(&entry->exp_entry); 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;
} }