]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: raid56: properly handle the error when unable to find the missing stripe
authorQu Wenruo <wqu@suse.com>
Mon, 10 Oct 2022 10:36:06 +0000 (18:36 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 24 Oct 2022 13:26:54 +0000 (15:26 +0200)
commit1b13b8d70204722488301e2fb2451458e579518a
treed4473662322688279a1966c0ec0f3685d0c58b4b
parent41ac6d16a7d43afb312e2bfcda2c5658f305685d
btrfs: raid56: properly handle the error when unable to find the missing stripe

In raid56_alloc_missing_rbio(), if we can not determine where the
missing device is inside the full stripe, we just BUG_ON().

This is not necessary especially the only caller inside scrub.c is
already properly checking the return value, and will treat it as a
memory allocation failure.

Fix the error handling by:

- Add an extra warning for the reason
  Although personally speaking it may be better to be an ASSERT().

- Properly free the allocated rbio

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/raid56.c