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

commit 3065976b045f77a910809fa7699f99a1e7c0dbbb upstream.

Since now flush_write_bio() could return error, kill the BUG_ON() first.
Then don't call flush_write_bio() unconditionally, instead we check the
return value from __extent_writepage() first.

If __extent_writepage() fails, we do cleanup, and return error without
submitting the possible corrupted or half-baked bio.

If __extent_writepage() successes, then we 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