]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: init_permissions() shouldn't return ENOENT in a specific case
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 19 Jan 2016 23:33:48 +0000 (15:33 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 19 Jan 2016 23:33:48 +0000 (15:33 -0800)
If op is bucket creation it should ignore ENOENT. Otherwise we should
make sure we return the appropriate error.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_main.cc
src/rgw/rgw_op.cc
src/rgw/rgw_op.h
src/rgw/rgw_rest.cc
src/rgw/rgw_rest.h

index a878017617d8fc38ee70798af79a3ab0e8674937..246f0163671145a1c902a6e3702c99c9213786e6 100644 (file)
@@ -598,7 +598,7 @@ static int process_request(RGWRados *store, RGWREST *rest, RGWRequest *req, RGWC
   }
 
   req->log(s, "init permissions");
-  ret = handler->init_permissions();
+  ret = handler->init_permissions(op);
   if (ret < 0) {
     abort_early(s, op, ret, handler);
     goto done;
index 01965891cd6d1a8030a4c5d1f9d5a0c5482dd9f9..4225c69166131201ee8f7913dda05c1d005cd2fa 100644 (file)
@@ -425,7 +425,7 @@ static int rgw_build_bucket_policies(RGWRados *store, struct req_state *s)
     }
   }
 
-  return 0;
+  return ret;
 }
 
 /**
index 06d0f206c76c6c5f6fac3d2ad911602d86eb4304..f0555d26a9341fa7dcf2e2dca38de16d5c168dc1 100644 (file)
@@ -1370,7 +1370,7 @@ public:
 
   virtual RGWOp *get_op(RGWRados *store);
   virtual void put_op(RGWOp *op);
-  virtual int init_permissions() {
+  virtual int init_permissions(RGWOp *op) {
     return 0;
   }
   virtual int retarget(RGWOp *op, RGWOp **new_op) {
index db7a056f23884358fa3f32fe81d9f633532c7cbd..b97d8b810176f988e303445a7a8f42ecd5d279b5 100644 (file)
@@ -1348,8 +1348,11 @@ static http_op op_from_method(const char *method)
   return OP_UNKNOWN;
 }
 
-int RGWHandler_ObjStore::init_permissions()
+int RGWHandler_ObjStore::init_permissions(RGWOp *op)
 {
+  if (op->get_type() == RGW_OP_CREATE_BUCKET)
+    return 0;
+
   return do_init_permissions();
 }
 
index ca143ce4da10eb8a41eb6b633deabad8c06ce2b0..3ddd1bfb0a9ac2adcdb984cda6c088762dec1d05 100644 (file)
@@ -356,7 +356,7 @@ protected:
 public:
   RGWHandler_ObjStore() {}
   virtual ~RGWHandler_ObjStore() {}
-  int init_permissions();
+  int init_permissions(RGWOp *op);
   int read_permissions(RGWOp *op);
   virtual int retarget(RGWOp *op, RGWOp **new_op) {
     *new_op = op;