]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: Call btrfs_pin_reserved_extent only during active transaction
authorNikolay Borisov <nborisov@suse.com>
Mon, 20 Jan 2020 14:09:11 +0000 (16:09 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 23 Mar 2020 16:01:36 +0000 (17:01 +0100)
commite0461bbbf1bc285a33be2f15efe7635e172c7c02
tree681df269f573cfcfaaaa7ce005a9b4d20d976763
parent41937be04bef15a0ec8b65a9d7b7a6f5fb3d4086
btrfs: Call btrfs_pin_reserved_extent only during active transaction

Calling btrfs_pin_reserved_extent makes sense only with a valid
transaction since pinned extents are processed from transaction commit
in btrfs_finish_extent_commit. In case of error it's sufficient to
adjust the reserved counter to account for log tree extents allocated in
the last transaction.

This commit moves btrfs_pin_reserved_extent to be called only with valid
transaction handle and otherwise uses the newly introduced
unaccount_log_buffer to adjust "reserved". If this is not done if a
failure occurs before transaction is committed WARN_ON are going to be
triggered on unmount. This was especially pronounced with generic/475
test.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c