From ead5bc78a2d0d7812761f4e40d985ae2eb81f2ce Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Fri, 26 Aug 2011 12:27:46 -0400 Subject: [PATCH] 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 --- daemon/name_cache.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/daemon/name_cache.c b/daemon/name_cache.c index b2b628f..9a0e737 100644 --- a/daemon/name_cache.c +++ b/daemon/name_cache.c @@ -502,30 +502,32 @@ static int name_cache_entry_update( entry->fh.len = 0; 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, info->fileid, &entry->attributes); - - if (status == NO_ERROR) { - 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); + if (status) + 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); } else if (entry->attributes) { /* positive -> negative entry, deref the attributes */ attr_cache_entry_deref(&cache->attributes, entry->attributes); entry->attributes = NULL; } name_cache_entry_updated(cache, entry); +out: return status; }