summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-10-02 14:50:57 -0700
committerYehuda Sadeh <yehuda@inktank.com>2013-10-02 14:50:57 -0700
commitbaf1d409a6953000036ca8c188441c17688c9dbd (patch)
tree3ee8b06d8435dd1c02cb4d7edd1308c2ce221cb5
parent563517df87b28dddaa2b434f5e116abdfd6bd075 (diff)
downloadceph-baf1d409a6953000036ca8c188441c17688c9dbd.tar.gz
rgw: init quota
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r--src/rgw/rgw_main.cc7
-rw-r--r--src/rgw/rgw_op.cc4
-rw-r--r--src/rgw/rgw_op.h8
3 files changed, 19 insertions, 0 deletions
diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc
index 54db609521c..acaa5deffee 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 c5a0c1c1a77..b9b4c53d696 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 75919296114..eee5ea99065 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;