]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: extent_io: Handle errors better in btree_write_cache_pages()
authorQu Wenruo <wqu@suse.com>
Wed, 20 Mar 2019 06:27:43 +0000 (14:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Nov 2020 11:35:55 +0000 (12:35 +0100)
commit22bb77c13fbeeef2e0d0a8506c4efdde41598d32
tree2608b2982c51a0d8ed971e41115a525b5da32be9
parenteeda803b77d6cc80c9f9dffcfc86cddc5a52c0fe
btrfs: extent_io: Handle errors better in btree_write_cache_pages()

commit 2b952eea813b1f7e7d4b9782271acd91625b9bb9 upstream.

In btree_write_cache_pages(), we can only get @ret <= 0.
Add an ASSERT() for it just in case.

Then instead of submitting the write bio even we got some error, check
the return value first.
If we have already hit some error, just clean up the corrupted or
half-baked bio, and return error.

If there is no error so far, then call flush_write_bio() and return the
result.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/extent_io.c