]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: init quota
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 2 Oct 2013 21:50:57 +0000 (14:50 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Wed, 2 Oct 2013 21:50:57 +0000 (14:50 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_main.cc
src/rgw/rgw_op.cc
src/rgw/rgw_op.h

index 54db609521cc8fc397a69f22cf0a7676bcb2caae..acaa5deffeea2a697a4f2296926c6557a1cb5193 100644 (file)
@@ -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) {
index c5a0c1c1a77066c1f1675c5828c1512b7f490382..b9b4c53d6961eda456a6759448a9e1b60e7c6ff6 100644 (file)
@@ -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;
index 759192961148423d6410dfe0ab1561ba526c84c4..eee5ea9906533a9d2edf31ef3cf0cbcf3f1f95f0 100644 (file)
@@ -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;