android_kernel_samsung_a7y1.../drivers/md/persistent-data
Hou Tao 06b256911c dm btree: increase rebalance threshold in __rebalance2()
commit 474e559567fa631dea8fb8407ab1b6090c903755 upstream.

We got the following warnings from thin_check during thin-pool setup:

  $ thin_check /dev/vdb
  examining superblock
  examining devices tree
    missing devices: [1, 84]
      too few entries in btree_node: 41, expected at least 42 (block 138, max_entries = 126)
  examining mapping tree

The phenomenon is the number of entries in one node of details_info tree is
less than (max_entries / 3). And it can be easily reproduced by the following
procedures:

  $ new a thin pool
  $ presume the max entries of details_info tree is 126
  $ new 127 thin devices (e.g. 1~127) to make the root node being full
    and then split
  $ remove the first 43 (e.g. 1~43) thin devices to make the children
    reblance repeatedly
  $ stop the thin pool
  $ thin_check

The root cause is that the B-tree removal procedure in __rebalance2()
doesn't guarantee the invariance: the minimal number of entries in
non-root node should be >= (max_entries / 3).

Simply fix the problem by increasing the rebalance threshold to
make sure the number of entries in each child will be greater
than or equal to (max_entries / 3 + 1), so no matter which
child is used for removal, the number will still be valid.

Cc: stable@vger.kernel.org
Signed-off-by: Hou Tao <houtao1@huawei.com>
Acked-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-07 13:12:55 +02:00
..
dm-array.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-array.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-bitset.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-bitset.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-block-manager.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-block-manager.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-btree-internal.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-btree-remove.c dm btree: increase rebalance threshold in __rebalance2() 2020-04-07 13:12:55 +02:00
dm-btree-spine.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-btree.c dm btree: fix order of block initialization in btree_split_beneath 2020-04-06 21:10:27 +02:00
dm-btree.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-persistent-data-internal.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-space-map-common.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-space-map-common.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-space-map-disk.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-space-map-disk.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-space-map-metadata.c dm space map metadata: fix missing store of apply_bops() return value 2020-04-06 21:10:30 +02:00
dm-space-map-metadata.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-space-map.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-transaction-manager.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dm-transaction-manager.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30