From ed6f1f04bd4d7a73ed26b3bb0d5e0df1cc0acf42 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Tue, 3 Aug 2010 21:21:20 -0700 Subject: [PATCH] A few attempted bugfixes for log data lifetimes. A much better fix will depend on reworking this code a bit more. --- bluesky/cloudlog.c | 7 ++++++- bluesky/file.c | 6 ++++-- bluesky/init.c | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) 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; -- 2.20.1