]> granicus.if.org Git - apache/commitdiff
When attempting to set the stale lock, we will pass try_lock twice. If we
authorGraham Leggett <minfrin@apache.org>
Thu, 27 Aug 2009 21:44:48 +0000 (21:44 +0000)
committerGraham Leggett <minfrin@apache.org>
Thu, 27 Aug 2009 21:44:48 +0000 (21:44 +0000)
already have the lock the first time, we must also have the lock the second
time.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@808649 13f79535-47bb-0310-9956-ffa450edef68

modules/cache/cache_util.c

index e287553ccd60a84a86c43c75acd8891a892bb630..73cf7b895150cf0c8567cf97e5cd3d6e122d6b95 100644 (file)
@@ -195,12 +195,19 @@ CACHE_DECLARE(apr_status_t) ap_cache_try_lock(cache_server_conf *conf,
     apr_finfo_t finfo;
     finfo.mtime = 0;
     apr_file_t *lockfile;
+    void *dummy;
 
     if (!conf || !conf->lock || !conf->lockpath) {
         /* no locks configured, leave */
         return APR_SUCCESS;
     }
 
+    /* lock already obtained earlier? if so, success */
+    apr_pool_userdata_get(&dummy, CACHE_LOCKFILE_KEY, r->pool);
+    if (dummy) {
+       return APR_SUCCESS;
+    }
+
     /* create the key if it doesn't exist */
     if (!key) {
         cache_generate_key(r, r->pool, &key);