Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 5100 invoked from network); 4 Oct 2010 12:46:36 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 Oct 2010 12:46:36 -0000 Received: (qmail 72451 invoked by uid 500); 4 Oct 2010 12:46:35 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 72236 invoked by uid 500); 4 Oct 2010 12:46:32 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 72229 invoked by uid 99); 4 Oct 2010 12:46:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Oct 2010 12:46:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 04 Oct 2010 12:46:29 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 23DC923889E3; Mon, 4 Oct 2010 12:46:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1004220 - in /httpd/httpd/trunk/modules/cache: cache_util.c cache_util.h mod_cache.c Date: Mon, 04 Oct 2010 12:46:07 -0000 To: cvs@httpd.apache.org From: minfrin@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101004124607.23DC923889E3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: minfrin Date: Mon Oct 4 12:46:06 2010 New Revision: 1004220 URL: http://svn.apache.org/viewvc?rev=1004220&view=rev Log: Remove the attempt to pass the cache key into the lock functions, use cache->key instead for this. Fixes a segfault caused when cache->key was populated, but the passed in key was not. Modified: httpd/httpd/trunk/modules/cache/cache_util.c httpd/httpd/trunk/modules/cache/cache_util.h httpd/httpd/trunk/modules/cache/mod_cache.c Modified: httpd/httpd/trunk/modules/cache/cache_util.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_util.c?rev=1004220&r1=1004219&r2=1004220&view=diff ============================================================================== --- httpd/httpd/trunk/modules/cache/cache_util.c (original) +++ httpd/httpd/trunk/modules/cache/cache_util.c Mon Oct 4 12:46:06 2010 @@ -230,8 +230,8 @@ CACHE_DECLARE(apr_int64_t) ap_cache_curr * no point is it possible for this lock to permanently deny access to * the backend. */ -apr_status_t cache_try_lock(cache_server_conf *conf, - cache_request_rec *cache, request_rec *r, char *key) +apr_status_t cache_try_lock(cache_server_conf *conf, cache_request_rec *cache, + request_rec *r) { apr_status_t status; const char *lockname; @@ -256,12 +256,12 @@ apr_status_t cache_try_lock(cache_server } /* create the key if it doesn't exist */ - if (!key) { + if (!cache->key) { cache_generate_key(r, r->pool, &cache->key); } /* create a hashed filename from the key, and save it for later */ - lockname = ap_cache_generate_name(r->pool, 0, 0, key); + lockname = ap_cache_generate_name(r->pool, 0, 0, cache->key); /* lock files represent discrete just-went-stale URLs "in flight", so * we support a simple two level directory structure, more is overkill. @@ -324,8 +324,7 @@ apr_status_t cache_try_lock(cache_server * removed if the bucket brigade contains an EOS bucket. */ apr_status_t cache_remove_lock(cache_server_conf *conf, - cache_request_rec *cache, request_rec *r, char *key, - apr_bucket_brigade *bb) + cache_request_rec *cache, request_rec *r, apr_bucket_brigade *bb) { void *dummy; const char *lockname; @@ -363,12 +362,12 @@ apr_status_t cache_remove_lock(cache_ser char dir[5]; /* create the key if it doesn't exist */ - if (!key) { + if (!cache->key) { cache_generate_key(r, r->pool, &cache->key); } /* create a hashed filename from the key, and save it for later */ - lockname = ap_cache_generate_name(r->pool, 0, 0, key); + lockname = ap_cache_generate_name(r->pool, 0, 0, cache->key); /* lock files represent discrete just-went-stale URLs "in flight", so * we support a simple two level directory structure, more is overkill. @@ -692,7 +691,7 @@ int cache_check_freshness(cache_handle_t * A lock that exceeds a maximum age will be deleted, and another * request gets to make a new lock and try again. */ - status = cache_try_lock(conf, cache, r, (char *)h->cache_obj->key); + status = cache_try_lock(conf, cache, r); if (APR_SUCCESS == status) { /* we obtained a lock, follow the stale path */ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, Modified: httpd/httpd/trunk/modules/cache/cache_util.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_util.h?rev=1004220&r1=1004219&r2=1004220&view=diff ============================================================================== --- httpd/httpd/trunk/modules/cache/cache_util.h (original) +++ httpd/httpd/trunk/modules/cache/cache_util.h Mon Oct 4 12:46:06 2010 @@ -248,8 +248,8 @@ int cache_check_freshness(cache_handle_t * no point is it possible for this lock to permanently deny access to * the backend. */ -apr_status_t cache_try_lock(cache_server_conf *conf, - cache_request_rec *cache, request_rec *r, char *key); +apr_status_t cache_try_lock(cache_server_conf *conf, cache_request_rec *cache, + request_rec *r); /** * Remove the cache lock, if present. @@ -264,8 +264,7 @@ apr_status_t cache_try_lock(cache_server * removed if the bucket brigade contains an EOS bucket. */ apr_status_t cache_remove_lock(cache_server_conf *conf, - cache_request_rec *cache, request_rec *r, char *key, - apr_bucket_brigade *bb); + cache_request_rec *cache, request_rec *r, apr_bucket_brigade *bb); cache_provider_list *cache_get_providers(request_rec *r, cache_server_conf *conf, apr_uri_t uri); Modified: httpd/httpd/trunk/modules/cache/mod_cache.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/mod_cache.c?rev=1004220&r1=1004219&r2=1004220&view=diff ============================================================================== --- httpd/httpd/trunk/modules/cache/mod_cache.c (original) +++ httpd/httpd/trunk/modules/cache/mod_cache.c Mon Oct 4 12:46:06 2010 @@ -138,7 +138,7 @@ static int cache_quick_handler(request_r * backend without any attempt to cache. this stops * duplicated simultaneous attempts to cache an entity. */ - rv = cache_try_lock(conf, cache, r, NULL); + rv = cache_try_lock(conf, cache, r); if (APR_SUCCESS == rv) { /* @@ -384,7 +384,7 @@ static int cache_handler(request_rec *r) * backend without any attempt to cache. this stops * duplicated simultaneous attempts to cache an entity. */ - rv = cache_try_lock(conf, cache, r, NULL); + rv = cache_try_lock(conf, cache, r); if (APR_SUCCESS == rv) { /* @@ -599,8 +599,7 @@ static int cache_save_store(ap_filter_t ap_remove_output_filter(f); /* give someone else the chance to cache the file */ - cache_remove_lock(conf, cache, f->r, cache->handle ? - (char *)cache->handle->cache_obj->key : NULL, NULL); + cache_remove_lock(conf, cache, f->r, NULL); /* give up trying to cache, just step out the way */ APR_BRIGADE_PREPEND(in, cache->out); @@ -620,8 +619,7 @@ static int cache_save_store(ap_filter_t } /* conditionally remove the lock as soon as we see the eos bucket */ - cache_remove_lock(conf, cache, f->r, cache->handle ? - (char *)cache->handle->cache_obj->key : NULL, cache->out); + cache_remove_lock(conf, cache, f->r, cache->out); if (APR_BRIGADE_EMPTY(cache->out)) { if (APR_BRIGADE_EMPTY(in)) { @@ -641,8 +639,7 @@ static int cache_save_store(ap_filter_t ap_remove_output_filter(f); /* give someone else the chance to cache the file */ - cache_remove_lock(conf, cache, f->r, cache->handle ? - (char *)cache->handle->cache_obj->key : NULL, NULL); + cache_remove_lock(conf, cache, f->r, NULL); return ap_pass_brigade(f->next, in); } @@ -949,8 +946,7 @@ static int cache_save_filter(ap_filter_t reason)); /* let someone else attempt to cache */ - cache_remove_lock(conf, cache, r, cache->handle ? - (char *)cache->handle->cache_obj->key : NULL, NULL); + cache_remove_lock(conf, cache, r, NULL); return ap_pass_brigade(f->next, bb); } @@ -967,8 +963,7 @@ static int cache_save_filter(ap_filter_t ap_remove_output_filter(f); /* remove the lock file unconditionally */ - cache_remove_lock(conf, cache, r, cache->handle ? - (char *)cache->handle->cache_obj->key : NULL, NULL); + cache_remove_lock(conf, cache, r, NULL); /* ship the data up the stack */ return ap_pass_brigade(f->next, in); @@ -1071,8 +1066,7 @@ static int cache_save_filter(ap_filter_t /* Caching layer declined the opportunity to cache the response */ ap_remove_output_filter(f); - cache_remove_lock(conf, cache, r, cache->handle ? - (char *)cache->handle->cache_obj->key : NULL, NULL); + cache_remove_lock(conf, cache, r, NULL); return ap_pass_brigade(f->next, in); } @@ -1285,8 +1279,7 @@ static int cache_save_filter(ap_filter_t } /* let someone else attempt to cache */ - cache_remove_lock(conf, cache, r, cache->handle ? - (char *)cache->handle->cache_obj->key : NULL, NULL); + cache_remove_lock(conf, cache, r, NULL); return ap_pass_brigade(f->next, bb); } @@ -1300,8 +1293,7 @@ static int cache_save_filter(ap_filter_t "cache miss: store_headers failed"); ap_remove_output_filter(f); - cache_remove_lock(conf, cache, r, cache->handle ? - (char *)cache->handle->cache_obj->key : NULL, NULL); + cache_remove_lock(conf, cache, r, NULL); return ap_pass_brigade(f->next, in); }