Skip to content

Commit 50ff578

Browse files
fdmananakdave
authored andcommitted
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: 3ddebf2 ("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>
1 parent acee08a commit 50ff578

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fs/btrfs/tree-log.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3188,6 +3188,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
31883188
ret = btrfs_alloc_log_tree_node(trans, log_root_tree);
31893189
if (ret) {
31903190
mutex_unlock(&fs_info->tree_root->log_mutex);
3191+
blk_finish_plug(&plug);
31913192
goto out;
31923193
}
31933194
}

0 commit comments

Comments
 (0)