btrfs: drop log root for dropped roots
authorJosef Bacik <josef@toxicpanda.com>
Fri, 17 Jan 2020 14:12:45 +0000 (09:12 -0500)
committerDavid Sterba <dsterba@suse.com>
Thu, 23 Jan 2020 16:24:36 +0000 (17:24 +0100)
commit889bfa39086e86b52fcfaa04d72c95eaeb12f9a5
tree63acd99db84bd4543bc0a6c64f6c30a564811fa2
parent668e48af7a94985be7cf3b97a860d9819271d8bf
btrfs: drop log root for dropped roots

If we fsync on a subvolume and create a log root for that volume, and
then later delete that subvolume we'll never clean up its log root.  Fix
this by making switch_commit_roots free the log for any dropped roots we
encounter.  The extra churn is because we need a btrfs_trans_handle, not
the btrfs_transaction.

CC: stable@vger.kernel.org # 5.4+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/transaction.c