A few attempted bugfixes for log data lifetimes.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Wed, 4 Aug 2010 04:21:20 +0000 (21:21 -0700)
committerMichael Vrable <mvrable@cs.ucsd.edu>
Wed, 4 Aug 2010 04:21:20 +0000 (21:21 -0700)
A much better fix will depend on reworking this code a bit more.

bluesky/cloudlog.c
bluesky/file.c
bluesky/init.c

index c99d181..1cae4a5 100644 (file)
@@ -165,11 +165,15 @@ BlueSkyCloudPointer bluesky_cloudlog_serialize(BlueSkyCloudLog *log,
         BlueSkyCloudLog *log2
             = (BlueSkyCloudLog *)g_hash_table_lookup(log->fs->locations, &id);
         // TODO: refcount
         BlueSkyCloudLog *log2
             = (BlueSkyCloudLog *)g_hash_table_lookup(log->fs->locations, &id);
         // TODO: refcount
-        g_mutex_unlock(log->fs->lock);
         g_assert(log2 != NULL);
         g_assert(log2 != NULL);
+        bluesky_cloudlog_ref(log2);
+        g_mutex_unlock(log->fs->lock);
         bluesky_cloudlog_serialize(log2, state);
         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;
     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_string_append_len(state->data, log->data->data, log->data->len);
 
     log->location_flags |= CLOUDLOG_CLOUD;
+    g_mutex_unlock(log->lock);
 
     return log->location;
 }
 
     return log->location;
 }
index 34e103f..57193dd 100644 (file)
@@ -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);
             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);
         }
     }
             g_mutex_unlock(b->cloudref->lock);
         }
     }
index 3abc473..1db4283 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "bluesky-private.h"
 
 
 #include "bluesky-private.h"
 
-int bluesky_verbose = 1;
+int bluesky_verbose = 0;
 
 BlueSkyOptions bluesky_options;
 
 
 BlueSkyOptions bluesky_options;