From 0a7869d69df44b5993f7c5d6bbf9cce217561aff Mon Sep 17 00:00:00 2001 From: Chris Mason Date: Thu, 30 Oct 2008 11:11:39 -0400 Subject: [PATCH] Avoid tree of tree root cow when committing a clean FS The root node generation number code made commit_tree_root look like the kernel code. It forces a cow of the tree of tree roots even when the FS hasn't changed. This causes errors during fsck and other readonly operations. This adds a check to see if commit_tree_root is going to trigger writes to the tree of tree roots, and bails if none are pending. Signed-off-by: Chris Mason --- disk-io.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/disk-io.c b/disk-io.c index 0681572..3caf3a0 100644 --- a/disk-io.c +++ b/disk-io.c @@ -293,6 +293,9 @@ static int commit_tree_roots(struct btrfs_trans_handle *trans, struct list_head *next; struct extent_buffer *eb; + if (fs_info->readonly) + return 0; + eb = fs_info->tree_root->node; extent_buffer_get(eb); btrfs_cow_block(trans, fs_info->tree_root, eb, NULL, 0, &eb); -- 2.11.4.GIT