]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix btrfs_wait_ordered_range() so that it waits for all ordered extents
authorFilipe Manana <fdmanana@suse.com>
Thu, 13 Feb 2020 12:29:50 +0000 (12:29 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Feb 2020 23:39:08 +0000 (00:39 +0100)
commit82d1db358e2880f294b27f797b41908d76ede6be
tree9889a8ed46184e5a6aba6367950ed6af160d7bf0
parenta2b274f89e22eb85b8151333bf923c52214a3c56
Btrfs: fix btrfs_wait_ordered_range() so that it waits for all ordered extents

In btrfs_wait_ordered_range() once we find an ordered extent that has
finished with an error we exit the loop and don't wait for any other
ordered extents that might be still in progress.

All the users of btrfs_wait_ordered_range() expect that there are no more
ordered extents in progress after that function returns. So past fixes
such like the ones from the two following commits:

  72b925c30be0e6 ("btrfs: fix panic during relocation after ENOSPC before
                   writeback happens")

  016eb63e242e45 ("Btrfs: fix panic when starting bg cache writeout after
                   IO error")

don't work when there are multiple ordered extents in the range.

Fix that by making btrfs_wait_ordered_range() wait for all ordered extents
even after it finds one that had an error.

Link: https://github.com/kdave/btrfs-progs/issues/228#issuecomment-569777554
CC: stable@vger.kernel.org # 4.4+
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ordered-data.c