Fix clone problem

When clone happened, the origin header also will be updated in GenericObjectMap,
so the new header wraper(StripObjectHeader) should be updated too.

Fix #8282
Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
(cherry picked from commit 3aee1e0ffe0583f74c02d9c9e86c7fb267f3515c)
osd/ReplicatedPG: agent_work() fix next if finished early due to start_max

Backport: firefly

Signed-off-by: David Zafman <david.zafman@inktank.com>
(cherry picked from commit 9cf470cac8dd4d8f769e768f2de6b9eb67a3c3af)
osd, common: If agent_work() finds no objs to work on delay 5 (default) secs

Add config osd_agent_delay_time of 5 seconds
Honor delay by ignoring agent_choose_mode() calls
Add tier_delay to logger
Treat restart after delay like we were previously idle

Fixes: #8113
Backport: firefly

Signed-off-by: David Zafman <david.zafman@inktank.com>
(cherry picked from commit b7d31e5f5952c631dd4172bcb825e77a13fc60bc)
osd: Prevent divide by zero in agent_choose_mode()

Fixes: #8175
Backport: firefly

Signed-off-by: David Zafman <david.zafman@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit f47f867952e6b2a16a296c82bb9b585b21cde6c8)
osd/ReplicatedPG: fix whiteouts for other cache mode

We were special casing WRITEBACK mode for handling whiteouts; this needs to
also include the FORWARD and READONLY modes.  To avoid having to list
specific cache modes, though, just check != NONE.

Fixes: #8296
Backport: firefly
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 3e387d62ed95898db8a7d7163c2bacc363b8f617)
osd/ReplicatedPG: fix trim of in-flight hit_sets

We normally need to stat the hit_set to know how many bytes to adjust the
stats by.  If the hit_set was just written, we will get ENOENT.

Get the obc instead, which will either get the in-memory copy (because the
repop is still in flight) or load it off of disk.

Fixes: #8283
Backport: firefly
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 72fdd557c35cb721d4b502c5a8f68c878f11a19c)
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: throttle snap trimmming with simple delay

This is not particularly smart, but it is *a* knob that lets you make
the snap trimmer slow down.  It's a flow and a simple delay, so it is
adjustable at runtime.  Default is 0 (no change in behavior).

Partial solution for #6278.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 4413670d784efc2392359f0f22bca7c9056188f4)
client: add asok command to kick sessions that were remote reset

Fixes: #8021
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
(cherry picked from commit 09a1bc5a4601d356b9cc69be8541e6515d763861)
rgw: send user manifest header field

Fixes: #8170
Backport: firefly
If user manifest header exists (swift) send it as part of the object
header data.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 5cc5686039a882ad345681133c9c5a4a2c2fd86b)
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)
rgw: fix stripe_size calculation

Fixes: #8299
Backport: firefly
The stripe size calculation was broken, specifically affected cases
where we had manifest that described multiple parts.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 9968b938b5d47fdf3a67db134bd2ea6bf3a28086)
Revert "ReplicatedPG: block scrub on blocked object contexts"

This reverts commit e66f2e36c06ca00c1147f922d3513f56b122a5c0.
Reviewed-by: Sage Weil <sage@inktank.com>

0f3235d46c8fd6c537bd4aa8a3faec6c00f311a8 is the firefly commit
corresponding to e66f2e36c06ca00c1147f922d3513f56b122a5c0.

(cherry picked from commit 84728058dbb91b8ed062240b3373b18078f0c9ca)
0.80.1
0.80.1
0.80.1
0.80.1
osd/ReplicatedPG: do not queue NULL dup_op

We call start_flush() with a NULL op in a couple different places.  Do not
put a NULL pointer on the dup_ops list or we will crash later.

Fixes: #8328
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 0d67f9b0695765824bdc4a65fbed88edf8ea232e)
osd: handle race between osdmap and prepare_to_stop

If we get a MOSDMarkMeDown message and set service.state == STOPPING, we
kick the prepare_to_stop() thread.  Normally, it will wake up and then
set osd.state == STOPPING, and when we process the map message next we
will not warn.  However, if dispatch() takes the lock instead and processes
the map, it will fail the preparing_to_stop check and issue a spurious
warning.

Fix by checking for either preparing_to_stop or stopping.

Fixes: #8319
Backport: firefly, emperor, dumpling
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 6b858be0676f937a99dbd51321497f30c3a0097f)
osd/osd_types: add last_force_op_resend to pg_pool_t

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