diff options
-rw-r--r-- | src/server/image.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/server/image.c b/src/server/image.c index f9e8ea1..4c296af 100644 --- a/src/server/image.c +++ b/src/server/image.c @@ -160,11 +160,9 @@ void image_markComplete(dnbd3_image_t *image) */ void image_saveAllCacheMaps() { - spin_lock( &_images_lock ); for (int i = 0; i < _num_images; ++i) { image_saveCacheMap( _images[i] ); } - spin_unlock( &_images_lock ); } /** @@ -638,7 +636,11 @@ static int image_try_load(char *base, char *path, int withUplink) goto load_error; } else if ( existing->cache_map != NULL && cache_map == NULL ) { // Image seems complete now! + memlogf( "[INFO] Image %s is complete on disk now!", existing->lower_name ); memset( existing->cache_map, -1, IMGSIZE_TO_MAPBYTES(existing->filesize) ); + spin_lock( &existing->lock ); + image_markComplete( existing ); + spin_unlock( &existing->lock ); function_return = TRUE; goto load_error; } else { // Nothing changed about the existing image, so do nothing |