diff options
author | sr | 2012-12-20 17:41:33 +0100 |
---|---|---|
committer | sr | 2012-12-20 17:41:33 +0100 |
commit | 975eec970b59b3b66e483a54f6244e752f3ed726 (patch) | |
tree | 6c0dd8948b4f6161edd77a5e2b922f058d88ab49 | |
parent | ... (diff) | |
download | dnbd3-975eec970b59b3b66e483a54f6244e752f3ed726.tar.gz dnbd3-975eec970b59b3b66e483a54f6244e752f3ed726.tar.xz dnbd3-975eec970b59b3b66e483a54f6244e752f3ed726.zip |
[SERVER] Handle uncached proxy-mode properly
-rw-r--r-- | src/server/job.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/server/job.c b/src/server/job.c index 7fb1286..e499b09 100644 --- a/src/server/job.c +++ b/src/server/job.c @@ -310,10 +310,13 @@ static void connect_proxy_images() } char cfname[1000] = {0}; off_t fs = image->filesize; - if (isworking && alloc_cache && image->cache_file) - snprintf(cfname, 1000, "%s", image->cache_file); - else if (isworking) + if (isworking && !(alloc_cache && image->cache_file)) + { image->working = TRUE; + memlogf("[WARNING] Proxy-Mode enabled without cache directory. This will most likely hurt performance."); + goto continue_with_next_image; + } + snprintf(cfname, 1000, "%s", image->cache_file); pthread_spin_unlock(&_spinlock); if (isworking && *cfname) { @@ -331,9 +334,7 @@ static void connect_proxy_images() { image->working = TRUE; memlogf("[INFO] Enabled relayed image %s (%lld)", image->low_name, (long long)fs); - pthread_spin_unlock(&_spinlock); - close(dh); - return; + goto continue_with_next_image; } unlink(cfname); memlogf("[WARNING] Image has gone away"); @@ -344,7 +345,7 @@ static void connect_proxy_images() } break; } // <-- end loop over servers - // If this point is reached, the replication initiation was not successful + // If this point is reached, replication was not successful pthread_spin_lock(&_spinlock); if (g_slist_find(_dnbd3_images, image) != NULL) { @@ -352,6 +353,7 @@ static void connect_proxy_images() image->file = NULL; } return_free_device(devname); +continue_with_next_image: pthread_spin_unlock(&_spinlock); close(dh); } |