From: Yan <yanzheng@21cn.com>
Date: Mon, 26 Nov 2007 15:58:13 +0000 (-0500)
Subject: Btrfs: Properly update right_nritems in push_leaf_left
X-Git-Tag: firefly_0821_release~15789^2~11^2~55^2~56^2~30^2~399
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=eef1c494a2d4212e13c67d05e9cc3cd1e6dfed5d;p=firefly-linux-kernel-4.4.55.git

Btrfs: Properly update right_nritems in push_leaf_left

The codes that fixup the right leaf and the codes that dirty the
extnet buffer use the variable 'right_nritems' ,  both of them expect
'right_nritems' is the number of items in right leaf after the push.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
---

diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 1b47fe71e0b4..3b16051b121b 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1717,11 +1717,10 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
 			      btrfs_item_nr_offset(push_items),
 			     (btrfs_header_nritems(right) - push_items) *
 			     sizeof(struct btrfs_item));
-
 	}
-	btrfs_set_header_nritems(right, right_nritems - push_items);
+	right_nritems -= push_items;
+	btrfs_set_header_nritems(right, right_nritems);
 	push_space = BTRFS_LEAF_DATA_SIZE(root);
-
 	for (i = 0; i < right_nritems; i++) {
 		item = btrfs_item_nr(right, i);