All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] btrfs-progs: ctree: Don't return error if first key mismatch on leaf
@ 2018-04-10  5:55 Qu Wenruo
  0 siblings, 0 replies; only message in thread
From: Qu Wenruo @ 2018-04-10  5:55 UTC (permalink / raw)
  To: linux-btrfs

When running btrfs/074 with enough CPUs, it's possible (around 1%) to
hit first key mismatch warning.

Most of such warning happens in split_leaf() where it can ignore error
from push_leaf_right(), some of such problem also happens in
btrfs_search_forward().

Since it could break normal tree operations, at least keep the warning
for debug build but change its return to 0 for leaf, so we won't break
normal tree operations.

And, any suggest/advice on this tree locking problem is welcome.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/disk-io.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index bb38f4098e9c..cf58e9babe34 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -442,6 +442,7 @@ static int verify_level_key(struct btrfs_fs_info *fs_info,
 		btrfs_err(fs_info,
 "tree level mismatch detected, bytenr=%llu level expected=%u has=%u",
 			  eb->start, level, found_level);
+		btrfs_print_tree(eb, false);
 #endif
 		return -EIO;
 	}
@@ -463,8 +464,16 @@ static int verify_level_key(struct btrfs_fs_info *fs_info,
 			  eb->start, first_key->objectid, first_key->type,
 			  first_key->offset, found_key.objectid,
 			  found_key.type, found_key.offset);
+		btrfs_print_tree(eb, false);
 	}
 #endif
+	/*
+	 * XXX: We seems to have locking problem for leaf, where we have race
+	 * updating parent nodeptr's first key.
+	 * So if this eb is leaf and first key doesn't match, still let it go.
+	 */
+	if (level == 0 && ret)
+		ret = 0;
 	return ret;
 }
 
-- 
2.17.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-10  5:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10  5:55 [PATCH RFC] btrfs-progs: ctree: Don't return error if first key mismatch on leaf Qu Wenruo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.