OSDN Git Service

btrfs: fix qgroup_free wrong num_bytes in btrfs_subvolume_reserve_metadata
authorLu Fengqi <lufq.fnst@cn.fujitsu.com>
Thu, 9 Aug 2018 01:46:04 +0000 (09:46 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Sep 2018 20:41:21 +0000 (22:41 +0200)
commit29d76c9853a24bbec8ef6efaff62f2feb4355575
treed04bbafce7a38c50c75fb842d11fe0a55e60db37
parent15c4b1902f0e35dd51bb79fca73c50b6d14df699
btrfs: fix qgroup_free wrong num_bytes in btrfs_subvolume_reserve_metadata

commit a5b7f4295eeae8b05ca91f6d145cd8773b08de9e upstream.

After btrfs_qgroup_reserve_meta_prealloc(), num_bytes will be assigned
again by btrfs_calc_trans_metadata_size(). Once block_rsv fails, we
can't properly free the num_bytes of the previous qgroup_reserve. Use a
separate variable to store the num_bytes of the qgroup_reserve.

Delete the comment for the qgroup_reserved that does not exist and add a
comment about use_global_rsv.

Fixes: c4c129db5da8 ("btrfs: drop unused parameter qgroup_reserved")
CC: stable@vger.kernel.org # 4.18+
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/extent-tree.c