]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: also check quota before starting write
authorYehuda Sadeh <yehuda@inktank.com>
Tue, 1 Oct 2013 20:37:56 +0000 (13:37 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 1 Oct 2013 20:37:56 +0000 (13:37 -0700)
In that case we only do it if it's not chunked upload (for which we
don't have the content length).

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_op.cc

index 4dd6bf39a26c08247a44b1b06869a480141b6a85..c5a0c1c1a77066c1f1675c5828c1512b7f490382 100644 (file)
@@ -1400,6 +1400,14 @@ void RGWPutObj::execute()
     ldout(s->cct, 15) << "supplied_md5=" << supplied_md5 << dendl;
   }
 
+  if (!chunked_upload) { /* with chunked upload we don't know how big is the upload.
+                            we also check sizes at the end anyway */
+    ret = store->check_quota(s->bucket, bucket_quota, s->content_length);
+    if (ret < 0) {
+      goto done;
+    }
+  }
+
   if (supplied_etag) {
     strncpy(supplied_md5, supplied_etag, sizeof(supplied_md5) - 1);
     supplied_md5[sizeof(supplied_md5) - 1] = '\0';