@@ -1937,9 +1937,14 @@ struct btrfs_root *open_ctree(struct super_block *sb,
btrfs_set_opt(fs_info->mount_opt, SSD);
}
- if (btrfs_super_log_root(disk_super) != 0) {
+ if (btrfs_super_log_root(disk_super) != 0 &&
+ !(fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR)) {
u64 bytenr = btrfs_super_log_root(disk_super);
+ unsigned int s_flags = sb->s_flags;
+ if (s_flags & MS_RDONLY)
+ sb->s_flags &= ~MS_RDONLY;
+
if (fs_devices->rw_devices == 0) {
printk(KERN_WARNING "Btrfs log replay required "
"on RO media\n");
@@ -1969,6 +1974,8 @@ struct btrfs_root *open_ctree(struct super_block *sb,
ret = btrfs_commit_super(tree_root);
BUG_ON(ret);
}
+
+ sb->s_flags = s_flags;
}
ret = btrfs_find_orphan_roots(tree_root);