{
BlueSkyFS *fs = inode->fs;
+ g_mutex_lock(fs->lock);
+ bluesky_list_unlink(&fs->dirty_list, inode->dirty_list);
+ inode->dirty_list = NULL;
+ g_mutex_unlock(fs->lock);
+
/* Inode is clean; nothing to do. */
if (inode->change_count == inode->change_commit)
return;
bluesky_inode_ref(inode);
- bluesky_list_unlink(&fs->dirty_list, fs->dirty_list.prev);
- inode->dirty_list = NULL;
-
g_mutex_unlock(fs->lock);
g_mutex_lock(inode->lock);
bluesky_inode_ref(inode);
- bluesky_list_unlink(&fs->accessed_list, fs->accessed_list.prev);
- inode->accessed_list = bluesky_list_prepend(&fs->accessed_list, inode);
-
g_mutex_unlock(fs->lock);
g_mutex_lock(inode->lock);
+
+ g_mutex_lock(fs->lock);
+ bluesky_list_unlink(&fs->accessed_list, inode->accessed_list);
+ inode->accessed_list = bluesky_list_prepend(&fs->accessed_list, inode);
+ g_mutex_unlock(fs->lock);
+
drop_caches(inode);
+
g_mutex_unlock(inode->lock);
bluesky_inode_unref(inode);
inode->access_time = bluesky_get_current_time();
g_mutex_lock(inode->fs->lock);
+ bluesky_list_unlink(&inode->fs->accessed_list, inode->accessed_list);
inode->accessed_list = bluesky_list_prepend(&inode->fs->accessed_list, inode);
g_mutex_unlock(inode->fs->lock);