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: 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>
common/crc32c_intel_fast: avoid reading partial trailing word

The optimized intel code reads in word-sized chunks, knowing that the
allocator will only hand out memory in word-sized increments.   This makes
valgrind unhappy.  Whitelisting doesn't work because for some reason there
is no caller context (probably because of some interaction with yasm?).

Instead, just use the baseline code for the last few bytes.  This should
not be significant.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
Merge remote-tracking branch 'gh/next'
Merge pull request #568 from roaldvanloon/wip-cleanup-globals

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