Mercurial > hg > nginx
changeset 3727:fd2bb219de22
change order
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 02 Aug 2010 12:32:33 +0000 |
parents | 282ddd49f925 |
children | a29bb11f8c80 |
files | src/http/ngx_http_file_cache.c |
diffstat | 1 files changed, 23 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/ngx_http_file_cache.c Mon Aug 02 12:27:58 2010 +0000 +++ b/src/http/ngx_http_file_cache.c Mon Aug 02 12:32:33 2010 +0000 @@ -1022,19 +1022,17 @@ 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 @@ 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 - */ - - ngx_queue_remove(q); - ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node); - - 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); - + if (fcn->count == 0) { + ngx_http_file_cache_delete(cache, q, name); continue; } - ngx_http_file_cache_delete(cache, q, name); + 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 + */ + + ngx_queue_remove(q); + ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node); + + 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);