]> git.hungrycats.org Git - linux/commitdiff
Btrfs: qgroup: free reserved in exceeding quota.
authorDongsheng Yang <yangds.fnst@cn.fujitsu.com>
Fri, 12 Dec 2014 08:44:34 +0000 (16:44 +0800)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Sun, 19 Apr 2015 15:56:16 +0000 (11:56 -0400)
When we exceed quota limit in writing, we will free
some reserved extent when we need to drop but not free
account in qgroup. It means, each time we exceed quota
in writing, there will be some remain space in qg->reserved
we can not use any more. If things go on like this, the
all space will be ate up.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
(cherry picked from commit 804ca127fb93988c6a9d5f2bf4a8f1a780c9a2d0)

fs/btrfs/extent-tree.c

index 24d7f6d80a2ba588fd1a345a7e4aeeb14787180f..0a4428acc8d3256bac0bfe11f6911f559feccaf1 100644 (file)
@@ -5475,8 +5475,11 @@ out_fail:
                        to_free = 0;
        }
        spin_unlock(&BTRFS_I(inode)->lock);
-       if (dropped)
+       if (dropped) {
+               if (root->fs_info->quota_enabled)
+                       btrfs_qgroup_free(root, dropped * root->nodesize);
                to_free += btrfs_calc_trans_metadata_size(root, dropped);
+       }
 
        if (to_free) {
                btrfs_block_rsv_release(root, block_rsv, to_free);