linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: allow processes with cap_sys_resource to exceed quota
@ 2017-04-21 10:09 Sargun Dhillon
  2017-04-21 10:34 ` Sargun Dhillon
  2017-04-21 11:05 ` Adam Borowski
  0 siblings, 2 replies; 6+ messages in thread
From: Sargun Dhillon @ 2017-04-21 10:09 UTC (permalink / raw)
  To: linux-btrfs

This patch allows processes with CAP_SYS_RESOURCE to exceed the qgroup
limit. It's useful for administrative programs, such as log rotation,
that may need to temporarily use more disk space in order to free up
a greater amount of overall disk space without yielding more disk
space to the rest of userland.

Signed-off-by: Sargun Dhillon <sargun@sargun.me>
---
 fs/btrfs/qgroup.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index a59801d..b0af39c 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -2349,6 +2349,9 @@ int btrfs_qgroup_inherit(struct btrfs_trans_handle *trans,
 
 static bool qgroup_check_limits(const struct btrfs_qgroup *qg, u64 num_bytes)
 {
+	if (capable(CAP_SYS_RESOURCE))
+		return true;
+
 	if ((qg->lim_flags & BTRFS_QGROUP_LIMIT_MAX_RFER) &&
 	    qg->reserved + (s64)qg->rfer + num_bytes > qg->max_rfer)
 		return false;
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-05-05 18:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-21 10:09 [PATCH] btrfs: allow processes with cap_sys_resource to exceed quota Sargun Dhillon
2017-04-21 10:34 ` Sargun Dhillon
2017-04-21 11:05 ` Adam Borowski
2017-04-21 12:27   ` Sargun Dhillon
2017-05-05 18:22     ` David Sterba
2017-05-05 18:25       ` Sargun Dhillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).