From: Max Kellermann <max.kellermann@ionos.com>
To: xiubli@redhat.com, idryomov@gmail.com, ceph-devel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Max Kellermann <max.kellermann@ionos.com>
Subject: [PATCH] fs/ceph/quota: ignore quota with CAP_SYS_RESOURCE
Date: Thu, 29 Aug 2024 12:57:17 +0200 [thread overview]
Message-ID: <20240829105717.1163483-1-max.kellermann@ionos.com> (raw)
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
reply other threads:[~2024-08-29 10:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240829105717.1163483-1-max.kellermann@ionos.com \
--to=max.kellermann@ionos.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xiubli@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®