mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs/ceph/quota: ignore quota with CAP_SYS_RESOURCE
@ 2024-08-29 10:57 Max Kellermann
  0 siblings, 0 replies; only message in thread
From: Max Kellermann @ 2024-08-29 10:57 UTC (permalink / raw)
  To: xiubli, idryomov, ceph-devel; +Cc: linux-kernel, Max Kellermann

CAP_SYS_RESOURCE allows users to "override disk quota limits".  Most
filesystems have a CAP_SYS_RESOURCE check in all quota check code
paths, but Ceph currently does not.  This patch implements the
feature.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
 fs/ceph/quota.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/ceph/quota.c b/fs/ceph/quota.c
index 06ee397e0c3a..666315ec74d3 100644
--- a/fs/ceph/quota.c
+++ b/fs/ceph/quota.c
@@ -429,6 +429,9 @@ bool ceph_quota_is_max_files_exceeded(struct inode *inode)
 
 	WARN_ON(!S_ISDIR(inode->i_mode));
 
+	if (capable(CAP_SYS_RESOURCE))
+		return false;
+
 	return check_quota_exceeded(inode, QUOTA_CHECK_MAX_FILES_OP, 1);
 }
 
@@ -451,6 +454,9 @@ bool ceph_quota_is_max_bytes_exceeded(struct inode *inode, loff_t newsize)
 	if (newsize <= size)
 		return false;
 
+	if (capable(CAP_SYS_RESOURCE))
+		return false;
+
 	return check_quota_exceeded(inode, QUOTA_CHECK_MAX_BYTES_OP, (newsize - size));
 }
 
@@ -473,6 +479,9 @@ bool ceph_quota_is_max_bytes_approaching(struct inode *inode, loff_t newsize)
 	if (newsize <= size)
 		return false;
 
+	if (capable(CAP_SYS_RESOURCE))
+		return false;
+
 	return check_quota_exceeded(inode, QUOTA_CHECK_MAX_BYTES_APPROACHING_OP,
 				    (newsize - size));
 }
-- 
2.45.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-08-29 10:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-29 10:57 [PATCH] fs/ceph/quota: ignore quota with CAP_SYS_RESOURCE Max Kellermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®