diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 0334452a7be1e4731700c123d6bbc18fcbc4ae9c..aea1b3cee8876efd9b2ad11ca340a0d4ba538684 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -716,6 +716,8 @@ struct btrfs_delayed_root; #define BTRFS_FS_BTREE_ERR 11 #define BTRFS_FS_LOG1_ERR 12 #define BTRFS_FS_LOG2_ERR 13 +#define BTRFS_FS_QUOTA_OVERRIDE 14 + /* * Indicate that a whole-filesystem exclusive operation is running * (device replace, resize, device add/delete, balance) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index deffbeb74a0be7499c42578efc51903c3737f3bf..458fec01d814d75ad8f0d06becb9af93e19bfd1c 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -2338,6 +2338,11 @@ static int qgroup_reserve(struct btrfs_root *root, u64 num_bytes, bool enforce) if (num_bytes == 0) return 0; + + if (test_bit(BTRFS_FS_QUOTA_OVERRIDE, &fs_info->flags) && + capable(CAP_SYS_RESOURCE)) + enforce = false; + retry: spin_lock(&fs_info->qgroup_lock); quota_root = fs_info->quota_root;