Skip to contentSkip to conversation

Drop dirty roots created by log replay immediately when mount -o ro

PATCH New Yan Zheng 1 participant 1 message Nov 20, 2008 Btrfs file system

lore
Share & tools
lore

Yan Zheng

author
#0 lore raw

PATCH 1/1 Drop dirty roots created by log replay immediately when mount -o ro

Hello,

The log replay products 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,

---

fs/btrfs/disk-io.c +5 -0
diff -urp 1/fs/btrfs/disk-io.c 2/fs/btrfs/disk-io.c
@@ -1756,6 +1756,11 @@ struct btrfs_root *open_ctree(struct sup
 						      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)) {