rgw: remove use of s->bucket_cors

Some old code still tried to use s->bucket_cors, which was
abandoned in a cleanup work.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: OPTIONS request doesn't need to read object info

This is a bucket-only operation, so we shouldn't look at the
object. Object may not exist and we might respond with Not
Exists response which is not what we want.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: add a generic CORS response handling

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: tie CORS header response to all relevant operations

Have the CORS responses on all relevant operations. Also add headers
on failure cases.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: don't handle CORS if rule not found (is NULL)

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: fix CORS rule check

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: add COPY method to be handled by CORS

Was missing this http method.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: fix certain return status cases in CORS

Change return values in certain cases, reorder
checks, etc.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Merge branch 'wip-6078' into next

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
rgw: check object name after rebuilding it in S3 POST

Fixes: #6088
Backport: bobtail, cuttlefish, dumpling

When posting an object it is possible to provide a key
name that refers to the original filename, however we
need to verify that in the end we don't end up with an
empty object name.

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: flush pending data when completing multipart part upload

Fixes: #6111
Backport: dumpling
When completing the part upload we need to flush any data that we
aggregated and didn't flush yet. With earlier code didn't have to deal
with it as for multipart upload we didn't have any pending data.
What we do now is we call the regular atomic data completion
function that takes care of it.

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
osd/ReplicatedPG: set reply versions on dup op ACK

All other MOSDOpReply creators do this, with the exception of the pg
op.

Fixes: #6222
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
(cherry picked from commit 5148aac73d50593217455619bef95b8e1b296e10)
osd/ReplicatedPG: set reply versions for pg ops (PGLS)

Returning the current version for the pgid and last_user_version makes
some sense here.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
(cherry picked from commit b05f7ea5199fc190a3be887fac4d74417461e1ce)
cleanup: removed last references to globals from client

- There were some refs in SyntheticClient to g_(ceph_context|conf), I
  replaced them with client->cct and client->cct->_conf.
- There were some refs in fuse_ll to g_conf, also replaced them with
  client->cct or cfuse->client->cct where applicable.

This makes everything in src/client completely independent from globals.

Signed-off-by: Roald J. van Loon <roaldvanloon@gmail.com>
cleanup: removing refs to globals from libosd

Removed almost all references to globals, apart from two;

- In OSD.cc: reference to g_lockdep
- In PG.h: NamedState uses ceph_clock_now(g_ceph_context)

Signed-off-by: Roald J. van Loon <roaldvanloon@gmail.com>
cleanup: removing globals from common/obj_bencher

This file is in common/ but cant be included in libcommon.la because of
this reference. Removing it, making the binary calling it to pass the
correct cephcontext (rados, rest-bench).

Signed-off-by: Roald J. van Loon <roaldvanloon@gmail.com>
cleanup: reduced number of pointer indirection in osd

Signed-off-by: Roald J. van Loon <roaldvanloon@gmail.com>
Merge pull request #567 from roaldvanloon/wip-cleanup-globals

Reviewed-by: Sage Weil <sage@inktank.com>
cleanup: globals from libosd

There are some new globals introduced in libosd lately. This patch
cleans them.

Signed-off-by: Roald J. van Loon <roaldvanloon@gmail.com>
cleanup: passing context to NamedState for ceph_clock

This makes the constructor call on the subclasses explicit, and passes
the cct to the NamedState constructor. This cct is used by ceph_clock
to set enter_time.

Removes the last reference to g_ceph_context from libosd.

Signed-off-by: Roald J. van Loon <roaldvanloon@gmail.com>