From: Michael Vrable Date: Wed, 4 Aug 2010 04:21:20 +0000 (-0700) Subject: A few attempted bugfixes for log data lifetimes. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=ed6f1f04bd4d7a73ed26b3bb0d5e0df1cc0acf42;p=bluesky.git A few attempted bugfixes for log data lifetimes. A much better fix will depend on reworking this code a bit more. --- diff --git a/bluesky/cloudlog.c b/bluesky/cloudlog.c index c99d181..1cae4a5 100644 --- a/bluesky/cloudlog.c +++ b/bluesky/cloudlog.c @@ -165,11 +165,15 @@ BlueSkyCloudPointer bluesky_cloudlog_serialize(BlueSkyCloudLog *log, BlueSkyCloudLog *log2 = (BlueSkyCloudLog *)g_hash_table_lookup(log->fs->locations, &id); // TODO: refcount - g_mutex_unlock(log->fs->lock); g_assert(log2 != NULL); + bluesky_cloudlog_ref(log2); + g_mutex_unlock(log->fs->lock); bluesky_cloudlog_serialize(log2, state); + bluesky_cloudlog_unref(log2); } + g_mutex_lock(log->lock); + bluesky_cloudlog_fetch(log); g_assert(log->data != NULL); log->location = state->location; @@ -188,6 +192,7 @@ BlueSkyCloudPointer bluesky_cloudlog_serialize(BlueSkyCloudLog *log, g_string_append_len(state->data, log->data->data, log->data->len); log->location_flags |= CLOUDLOG_CLOUD; + g_mutex_unlock(log->lock); return log->location; } diff --git a/bluesky/file.c b/bluesky/file.c index 34e103f..57193dd 100644 --- a/bluesky/file.c +++ b/bluesky/file.c @@ -296,8 +296,10 @@ void bluesky_file_drop_cached(BlueSkyInode *inode) b->type = BLUESKY_BLOCK_REF; g_atomic_int_add(&inode->fs->cache_total, -1); g_mutex_lock(b->cloudref->lock); - bluesky_string_unref(b->cloudref->data); - b->cloudref->data = NULL; + if (b->cloudref->location_flags & CLOUDLOG_JOURNAL) { + bluesky_string_unref(b->cloudref->data); + b->cloudref->data = NULL; + } g_mutex_unlock(b->cloudref->lock); } } diff --git a/bluesky/init.c b/bluesky/init.c index 3abc473..1db4283 100644 --- a/bluesky/init.c +++ b/bluesky/init.c @@ -13,7 +13,7 @@ #include "bluesky-private.h" -int bluesky_verbose = 1; +int bluesky_verbose = 0; BlueSkyOptions bluesky_options;