[lustre-devel] [PATCH 13/19] lustre: quota: optimize capability check for root squash
James Simmons
jsimmons at infradead.org
Sun Nov 28 15:27:48 PST 2021
From: Sebastien Buisson <sbuisson at ddn.com>
On client side, checking for owner/group quota can be directly
bypassed if this is for root and there is no root squash.
Fixes: cd633cfc96 ("lustre: quota: nodemap squashed root cannot bypass quota")
WC-bug-id: https://jira.whamcloud.com/browse/LU-15141
Lustre-commit: f5fd5a363cc48e38c ("LU-15141 quota: optimize capability check for root squash")
Signed-off-by: Sebastien Buisson <sbuisson at ddn.com>
Reviewed-on: https://review.whamcloud.com/45322
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao at whamcloud.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
fs/lustre/osc/osc_cache.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/fs/lustre/osc/osc_cache.c b/fs/lustre/osc/osc_cache.c
index 1211438..7b7b49f 100644
--- a/fs/lustre/osc/osc_cache.c
+++ b/fs/lustre/osc/osc_cache.c
@@ -2385,7 +2385,12 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io,
}
/* check if the file's owner/group is over quota */
- if (!io->ci_noquota) {
+ /* do not check for root without root squash, because in this case
+ * we should bypass quota
+ */
+ if ((!oio->oi_cap_sys_resource ||
+ cli->cl_root_squash) &&
+ !io->ci_noquota) {
struct cl_object *obj;
struct cl_attr *attr;
unsigned int qid[MAXQUOTAS];
@@ -2400,20 +2405,8 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io,
qid[USRQUOTA] = attr->cat_uid;
qid[GRPQUOTA] = attr->cat_gid;
qid[PRJQUOTA] = attr->cat_projid;
- /*
- * if EDQUOT returned for root, we double check
- * if root squash enabled or not updated from server side.
- * without root squash, we should bypass quota for root.
- */
- if (rc == 0 && osc_quota_chkdq(cli, qid) == -EDQUOT) {
- if (oio->oi_cap_sys_resource &&
- !cli->cl_root_squash) {
- io->ci_noquota = 1;
- rc = 0;
- } else {
- rc = -EDQUOT;
- }
- }
+ if (rc == 0 && osc_quota_chkdq(cli, qid) == -EDQUOT)
+ rc = -EDQUOT;
if (rc)
return rc;
}
--
1.8.3.1
More information about the lustre-devel
mailing list