Revert "interm" this was a mistaken push. This reverts commit 9310f113af338143d71e03f02dcd9ef948116fdb.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/5f4bb969 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/5f4bb969 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/5f4bb969 Branch: refs/heads/3.0.x Commit: 5f4bb969f15d2a8eb6867138b1106e0028b6048a Parents: 9310f11 Author: [email protected] <[email protected]> Authored: Mon Mar 19 21:11:15 2012 -0700 Committer: John Plevyak <[email protected]> Committed: Mon Mar 19 21:11:15 2012 -0700 ---------------------------------------------------------------------- iocore/cache/CacheWrite.cc | 47 ++++++++++++++++++++------------------ 1 files changed, 25 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5f4bb969/iocore/cache/CacheWrite.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc index 42e7396..f87dea7 100644 --- a/iocore/cache/CacheWrite.cc +++ b/iocore/cache/CacheWrite.cc @@ -1543,33 +1543,36 @@ CacheVC::openWriteStartDone(int event, Event *e) first_buf = buf; goto Lsuccess; } + } Lcollision: - { - int if_writers = ((uintptr_t) info == CACHE_ALLOW_MULTIPLE_WRITES); - if (!od) { - if ((err = vol->open_write( - this, if_writers, cache_config_http_max_alts > 1 ? cache_config_http_max_alts : 0)) > 0) - goto Lfailure; - if (od->has_multiple_writers()) { - MUTEX_RELEASE(lock); - SET_HANDLER(&CacheVC::openWriteMain); - return callcont(CACHE_EVENT_OPEN_WRITE); - } - } - // check for collision - if (dir_probe(&first_key, vol, &dir, &last_collision)) { - od->reading_vec = 1; - int ret = do_read_call(&first_key); - if (ret == EVENT_RETURN) - goto Lcallreturn; - return ret; - } - if (f.update) { - // fail update because vector has been GC'd + { + int if_writers = ((uintptr_t) info == CACHE_ALLOW_MULTIPLE_WRITES); + CACHE_TRY_LOCK(lock, vol->mutex, mutex->thread_holding); + if (!lock) + VC_LOCK_RETRY_EVENT(); + if (!od) { + if ((err = vol->open_write( + this, if_writers, cache_config_http_max_alts > 1 ? cache_config_http_max_alts : 0)) > 0) goto Lfailure; + if (od->has_multiple_writers()) { + MUTEX_RELEASE(lock); + SET_HANDLER(&CacheVC::openWriteMain); + return callcont(CACHE_EVENT_OPEN_WRITE); } } + // check for collision + if (dir_probe(&first_key, vol, &dir, &last_collision)) { + od->reading_vec = 1; + int ret = do_read_call(&first_key); + if (ret == EVENT_RETURN) + goto Lcallreturn; + return ret; + } + if (f.update) { + // fail update because vector has been GC'd + goto Lfailure; + } } Lsuccess: od->reading_vec = 0;
