Btrfs: Drop dirty roots created by log replay immediately when
authorYan Zheng <zheng.yan@oracle.com>
Thu, 20 Nov 2008 15:25:19 +0000 (10:25 -0500)
committerChris Mason <chris.mason@oracle.com>
Thu, 20 Nov 2008 15:25:19 +0000 (10:25 -0500)
The log replay produces dirty roots. These dirty roots
should be dropped immediately if the fs is mounted as
ro. Otherwise they can be added to the dirty root list
again when remounting the fs as rw. Thank you,

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
fs/btrfs/disk-io.c

index 981652233f707e489e764025626d967bf1b100b4..fb04665e50053470a07304b752436a9a037df409 100644 (file)
@@ -1757,6 +1757,11 @@ struct btrfs_root *open_ctree(struct super_block *sb,
                                                      generation + 1);
                ret = btrfs_recover_log_trees(log_tree_root);
                BUG_ON(ret);
+
+               if (sb->s_flags & MS_RDONLY) {
+                       ret =  btrfs_commit_super(tree_root);
+                       BUG_ON(ret);
+               }
        }
 
        if (!(sb->s_flags & MS_RDONLY)) {