]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix leaked plug after failure syncing log on zoned filesystems
authorFilipe Manana <fdmanana@suse.com>
Wed, 6 Apr 2022 16:07:54 +0000 (17:07 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 19 Apr 2022 13:44:17 +0000 (15:44 +0200)
commit319d1812afedd6cf5159e4bc9cd8c4db43380f7d
tree57b09b8333dfe7f61d02ad8509bc5c30f23a4ab9
parent2f7824da9b04130b54e8a55c891d0ba7782db177
btrfs: fix leaked plug after failure syncing log on zoned filesystems

On a zoned filesystem, if we fail to allocate the root node for the log
root tree while syncing the log, we end up returning without finishing
the IO plug we started before, resulting in leaking resources as we
have started writeback for extent buffers of a log tree before. That
allocation failure, which typically is either -ENOMEM or -ENOSPC, is not
fatal and the fsync can safely fallback to a full transaction commit.

So release the IO plug if we fail to allocate the extent buffer for the
root of the log root tree when syncing the log on a zoned filesystem.

Fixes: 6c455433ae6907 ("btrfs: zoned: reorder log node allocation on zoned filesystem")
CC: stable@vger.kernel.org # 5.15+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c