rgw: don't allow multiple writers to same multiobject part

Fixes: #8269

A client might need to retry a multipart part write. The original thread
might race with the new one, trying to clean up after it, clobbering the
part's data.
The fix is to detect whether an original part already existed, and if so
use a different part name for it.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
rgw: don't error out on empty owner when setting acls

Fixes: #6892
Backport: dumpling, emperor
s3cmd specifies empty owner field when trying to set acls on object
/ bucket. We errored out as it didn't match the current owner name, but
with this change we ignore it.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 14cf4caff58cc2c535101d48c53afd54d8632104)
ReplicatedPG: add empty stat when we remove an object in recover_backfill

Subsequent updates to that object need to have their stats added
to the backfill info stats atomically with the last_backfill
update.

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit ecddd12b01be120fba87f5ac60539f98f2c69a28)
ReplicatedPG::recover_backfill: do not update last_backfill prematurely

Previously, we would update last_backfill on the backfill peer to

backfills_in_flight.empty() ? backfill_pos :
  backfills_in_flight.begin()->first

which is actually the next backfill to complete.  We want to update
last_backfill to the largest completed backfill instead.

We use the pending_backfill_updates mapping to identify the most
recently completed backfill.  Due to the previous patch, deletes
will also be included in that mapping.

Related sha1s from master:
4139e75d63b0503dbb7fea8036044eda5e8b7cf1
7a06a71e0f2023f66d003dfb0168f4fe51eaa058

We don't really want to backport those due to the changes in:
9ec35d5ccf6a86c380865c7fc96017a1f502560a

This patch does essentially the same thing, but using backfill_pos.

Fixse: #8162
Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: check for splitting when processing recover/backfill reservations

Fixes: 6565
Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 15ec5332ba4154930a0447e2bcf1acec02691e97)
Merge pull request #1827 from ceph/wip-6565-dumpling

Wip 6565 dumpling

Reviewed-by: Sage Weil <sage@inktank.com>
OSD: fix an osdmap_subscribe interface misuse

When calling osdmap_subscribe, you have to pass an epoch newer than the
current map's. _maybe_boot() was not doing this correctly -- we would
fail a check for being *in* the monitor's existing map range, and then
pass along the map prior to the monitor's range. But if we were exactly
one behind, that value would be our current epoch, and the request would
get dropped. So instead, make sure we are not *in contact* with the monitor's
existing map range.

Signed-off-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 290ac818696414758978b78517b137c226110bb4)
Merge pull request #1826 from ceph/wip-8162-dumpling

Wip 8162 dumpling

Reviewed-by: Sage Weil <sage@inktank.com>
mon/MonClient: remove stray _finish_hunting() calls

Callig _finish_hunting() clears out the bool hunting flag, which means we
don't retry by connection to another mon periodically.  Instead, we send
keepalives every 10s.  But, since we aren't yet in state HAVE_SESSION, we
don't check that the keepalives are getting responses.  This means that an
ill-timed connection reset (say, after we get a MonMap, but before we
finish authenticating) can drop the monc into a black hole that does not
retry.

Instead, we should *only* call _finish_hunting() when we complete the
authentication handshake.

Fixes: #8278
Backport: firefly, dumpling
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
(cherry picked from commit 77a6f0aefebebf057f02bfb95c088a30ed93c53f)
OSD::handle_pg_query: on dne pg, send lb=hobject_t() if deleting

We will set lb=hobject_t() if we resurrect the pg.  In that case,
we need to have sent that to the primary before hand.  If we
finish the removal before the pg is recreated, we'll just end
up backfilling it, which is ok since the pg doesn't exist anyway.

Fixes: #7740
Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit 04de781765dd5ac0e28dd1a43cfe85020c0854f8)

Conflicts:

	src/osd/OSD.cc
msg: Fix inconsistent message sequence negotiation during connection reset

Backport: firefly, emperor, dumpling

Signed-off-by: Guang Yang (yguang@yahoo-inc.com)
Reviewed-by: Greg Farnum <greg@inktank.com>
(cherry picked from commit bdee119076dd0eb65334840d141ccdf06091e3c9)
0.67.9
ReplicatedPG: lock snapdir obc during write

Otherwise, we won't block properly in prep_push_backfill_object.

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit b87bc2311aa4da065477f402a869e2edc1558e2f)

Conflicts:
	src/osd/ReplicatedPG.h
doc: Added Disable requiretty to quick start.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
doc: Added requiretty comment to preflight checklist.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
Merge remote-tracking branch 'origin/wip-8269-dumpling' into dumpling

Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Merge pull request #1931 from ceph/wip-7068-dumpling

Wip 7068 dumpling

Reviewed-by: Sage Weil <sage@inktank.com>
rgw: cut short object read if a chunk returns error

Fixes: #8289
Backport: firefly, dumpling
When reading an object, if we hit an error when trying to read one of
the rados objects then we should just stop. Otherwise we're just going
to continue reading the rest of the object, and since it can't be sent
back to the client (as we have a hole in the middle), we end up
accumulating everything in memory.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 03b0d1cfb7bd30a77fedcf75eb06476b21b14e95)
init-ceph: continue after failure doing osd data mount

If we are starting many daemons and hit an error, we normally note it and
move on.  Do the same when doing the pre-mount step.

Fixes: #8554
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 6a7e20147cc39ed4689809ca7d674d3d408f2a17)
osd: 'status' admin socket command

Basic stuff, like what state is the OSD in, and what osdmap epoch are
we on.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 09099c9e4c7d2aa31eb8a0b7c18e43272fae7ce2)