From baf1d409a6953000036ca8c188441c17688c9dbd Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Wed, 2 Oct 2013 14:50:57 -0700 Subject: [PATCH] rgw: init quota Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_main.cc | 7 +++++++ src/rgw/rgw_op.cc | 4 ++++ src/rgw/rgw_op.h | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 54db609521cc8..acaa5deffeea2 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -357,6 +357,13 @@ void RGWProcess::handle_request(RGWRequest *req) goto done; } + req->log(s, "init op"); + ret = op->init_processing(); + if (ret < 0) { + abort_early(s, op, ret); + goto done; + } + req->log(s, "verifying op mask"); ret = op->verify_op_mask(); if (ret < 0) { diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index c5a0c1c1a7706..b9b4c53d6961e 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -423,6 +423,10 @@ int RGWOp::verify_op_mask() int RGWOp::init_quota() { + /* no quota enforcement for system requests */ + if (s->system_request) + return 0; + /* init quota related stuff */ if (!(s->user.op_mask & RGW_OP_TYPE_MODIFY)) { return 0; diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index 7591929611484..eee5ea9906533 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -44,6 +44,14 @@ public: RGWOp() : s(NULL), dialect_handler(NULL), store(NULL), cors_exist(false) {} virtual ~RGWOp() {} + virtual int init_processing() { + int ret = init_quota(); + if (ret < 0) + return ret; + + return 0; + } + virtual void init(RGWRados *store, struct req_state *s, RGWHandler *dialect_handler) { this->store = store; this->s = s; -- 2.39.5