]> 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)
commita4d30fef98318b6fde079dcc6572616c0515112b
tree57b09b8333dfe7f61d02ad8509bc5c30f23a4ab9
parent7461731417a9c81cc701c836500c328b3d3918ef
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: fa7461fdaa6d81 ("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