]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: extent_io: add proper error handling to lock_extent_buffer_for_io()
authorQu Wenruo <wqu@suse.com>
Wed, 20 Mar 2019 06:27:46 +0000 (14:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Nov 2020 11:35:55 +0000 (12:35 +0100)
commit2311ea7ea04fbc15f51760d3b91f6a8381b06c9a
tree1d23ffe4118de9ecfaeb49921a0fc22e9d875b81
parent22bb77c13fbeeef2e0d0a8506c4efdde41598d32
btrfs: extent_io: add proper error handling to lock_extent_buffer_for_io()

commit 2e3c25136adfb293d517e17f761d3b8a43a8fc22 upstream.

This function needs some extra checks on locked pages and eb.  For error
handling we need to unlock locked pages and the eb.

There is a rare >0 return value branch, where all pages get locked
while write bio is not flushed.

Thankfully it's handled by the only caller, btree_write_cache_pages(),
as later write_one_eb() call will trigger submit_one_bio().  So there
shouldn't be any problem.

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