From: Liu Bo Date: Wed, 7 Sep 2016 21:48:28 +0000 (-0700) Subject: Btrfs: remove unnecessary btrfs_mark_buffer_dirty in split_leaf X-Git-Tag: v4.9-rc1~46^2~1 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=196e02490c934398f894e5cb0ee1ac8ad13ca576;p=linux.git Btrfs: remove unnecessary btrfs_mark_buffer_dirty in split_leaf When we're not able to get enough space through splitting leaf, we'd create a new sibling leaf instead, and it's possible that we return a zero-nritem sibling leaf and mark it dirty before it's in a consistent state. With CONFIG_BTRFS_FS_CHECK_INTEGRITY=y, the integrity check of check_leaf will report panic due to this zero-nritem non-root leaf. This removes the unnecessary btrfs_mark_buffer_dirty. Reported-by: Filipe Manana Signed-off-by: Liu Bo Signed-off-by: David Sterba --- diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 8f67a14fa974..f6ba165d3f81 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -4311,7 +4311,11 @@ static noinline int split_leaf(struct btrfs_trans_handle *trans, if (path->slots[1] == 0) fixup_low_keys(fs_info, path, &disk_key, 1); } - btrfs_mark_buffer_dirty(right); + /* + * We create a new leaf 'right' for the required ins_len and + * we'll do btrfs_mark_buffer_dirty() on this leaf after copying + * the content of ins_len to 'right'. + */ return ret; }