From: Yehuda Sadeh Date: Tue, 19 Jan 2016 23:33:48 +0000 (-0800) Subject: rgw: init_permissions() shouldn't return ENOENT in a specific case X-Git-Tag: v10.0.4~152^2^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=195ceed0a34fc46751c77e86fe766b932b5f91f2;p=ceph.git rgw: init_permissions() shouldn't return ENOENT in a specific case If op is bucket creation it should ignore ENOENT. Otherwise we should make sure we return the appropriate error. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index a878017617d..246f0163671 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -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; diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 01965891cd6..4225c691661 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -425,7 +425,7 @@ static int rgw_build_bucket_policies(RGWRados *store, struct req_state *s) } } - return 0; + return ret; } /** diff --git a/src/rgw/rgw_op.h b/src/rgw/rgw_op.h index 06d0f206c76..f0555d26a93 100644 --- a/src/rgw/rgw_op.h +++ b/src/rgw/rgw_op.h @@ -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) { diff --git a/src/rgw/rgw_rest.cc b/src/rgw/rgw_rest.cc index db7a056f238..b97d8b81017 100644 --- a/src/rgw/rgw_rest.cc +++ b/src/rgw/rgw_rest.cc @@ -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(); } diff --git a/src/rgw/rgw_rest.h b/src/rgw/rgw_rest.h index ca143ce4da1..3ddd1bfb0a9 100644 --- a/src/rgw/rgw_rest.h +++ b/src/rgw/rgw_rest.h @@ -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;