aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_file_cache.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2010-08-02 12:32:33 +0000
committerIgor Sysoev <igor@sysoev.ru>2010-08-02 12:32:33 +0000
commitc7b2e2a5702c728e85d10b2d3d1581ab23a84844 (patch)
tree0fc8ec701bf97e24959e919e759bce157ddd57d6 /src/http/ngx_http_file_cache.c
parent2108fabea23f3f6fc12f21c488262cb74f95688e (diff)
downloadnginx-c7b2e2a5702c728e85d10b2d3d1581ab23a84844.tar.gz
nginx-c7b2e2a5702c728e85d10b2d3d1581ab23a84844.zip
change order
Diffstat (limited to 'src/http/ngx_http_file_cache.c')
-rw-r--r--src/http/ngx_http_file_cache.c49
1 files changed, 22 insertions, 27 deletions
diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
index 2ad37ce47..95260d444 100644
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -1022,19 +1022,17 @@ ngx_http_file_cache_forced_expire(ngx_http_file_cache_t *cache)
fcn->count, fcn->exists,
fcn->key[0], fcn->key[1], fcn->key[2], fcn->key[3]);
- if (fcn->count) {
+ if (fcn->count == 0) {
+ ngx_http_file_cache_delete(cache, q, name);
+ } else {
if (tries++ < 20) {
continue;
}
wait = 1;
-
- break;
}
- ngx_http_file_cache_delete(cache, q, name);
-
break;
}
@@ -1097,32 +1095,29 @@ ngx_http_file_cache_expire(ngx_http_file_cache_t *cache)
fcn->count, fcn->exists,
fcn->key[0], fcn->key[1], fcn->key[2], fcn->key[3]);
- if (fcn->count) {
-
- p = ngx_hex_dump(key, (u_char *) &fcn->node.key,
- sizeof(ngx_rbtree_key_t));
-
- len = NGX_HTTP_CACHE_KEY_LEN - sizeof(ngx_rbtree_key_t);
- (void) ngx_hex_dump(p, fcn->key, len);
-
- /*
- * abnormally exited workers may leave locked cache entries,
- * and although it may be safe to remove them completely,
- * we prefer to remove them from inactive queue and rbtree
- * only, and to allow other leaks
- */
+ if (fcn->count == 0) {
+ ngx_http_file_cache_delete(cache, q, name);
+ continue;
+ }
- ngx_queue_remove(q);
- ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
+ p = ngx_hex_dump(key, (u_char *) &fcn->node.key,
+ sizeof(ngx_rbtree_key_t));
+ len = NGX_HTTP_CACHE_KEY_LEN - sizeof(ngx_rbtree_key_t);
+ (void) ngx_hex_dump(p, fcn->key, len);
- ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
- "ignore long locked inactive cache entry %*s, count:%d",
- 2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count);
+ /*
+ * abnormally exited workers may leave locked cache entries,
+ * and although it may be safe to remove them completely,
+ * we prefer to remove them from inactive queue and rbtree
+ * only, and to allow other leaks
+ */
- continue;
- }
+ ngx_queue_remove(q);
+ ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
- ngx_http_file_cache_delete(cache, q, name);
+ ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
+ "ignore long locked inactive cache entry %*s, count:%d",
+ 2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count);
}
ngx_shmtx_unlock(&cache->shpool->mutex);