PG::start_peering_interval: use check_new_interval for same_interval_since

Signed-off-by: Samuel Just <sam.just@inktank.com>
atomic_t: add atomic64_t

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
common/perf_counters: use atomics instead of a mutex

The mutex is way too expensive.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: remember osd weight when auto-marking osds out

If we automatically mark an OSD out, remember its OSD weight.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: restore previous weight when auto-marked out osd boots

When an OSD that was marked out boots, restore the weight it had before.

Signed-off-by: Sage Weil <sage@inktank.com>
ReplicatedPG::start_flush: send delete even if there are no snaps

Even if all snaps for the clone have been removed, we still have to
send the delete to ensure that when the object is recreated the
new snaps aren't included in the wrong clone.

Signed-off-by: Samuel Just <sam.just@inktank.com>
OSD: verify that client ops are targeted correctly in the current epoch

We were previously only looking at the epoch the op was sent in, which meant
that if we had dropped responsibility somewhere between send_epoch and our
current epoch, we would queue up the op until a new osdmap came along. If it
never did, we could block all client IO against us...

Fixes: #8338

Signed-off-by: Greg Farnum <greg@inktank.com>
common/perf_counters: use second atomic to make counters safe to read

Add a second counter so that we can detect a race with an add/inc during
read, and retry.

Signed-off-by: Sage Weil <sage@inktank.com>
osd_types: factor out is_new_interval from check_new_interval

Signed-off-by: Samuel Just <sam.just@inktank.com>
PG: replace is_split, acting_up_affected with should_restart_peering

This way, we restart peering using the same criteria as
check_new_interval.

Fixes: #8104
Signed-off-by: Samuel Just <sam.just@inktank.com>
osd_types: remove the pool_id argument from (is|check)_new_interval

Signed-off-by: Samuel Just <sam.just@inktank.com>
osd: include osd_objectstore in metadata reported to mon

Provide visibility into the OSD backend.

Signed-off-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>
Add header cache to DBObjectMap

OMap is used by PG to store PGLog, so it's called by each write operations.
Because leveldb don't play well in random read and "header_lock" limit the
concurrence. Add a LRU cache to avoid too much overload on seeking header.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
osd: fix session leak in ms_handle_fast_connect

Signed-off-by: Sage Weil <sage@inktank.com>
osd: fix narrow session refcount race

The set_priv() call consumes a ref.  Technically the local 's' is not
actually owned by use by the time we get to the con_front set_priv().

Signed-off-by: Sage Weil <sage@inktank.com>
mds: journal EImportFinish after adjusting subtree auth

Submitting EImportFinish may journal an extra ESubtreeMap as side
effect. The ESubtreeMap should reflects subtree state after import
is finished.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: include all of directory inode's replicas in rmdir witnesses

If a MDS crashed after journaling a rmdir operation, but before sending
MDentryUnlink messages. Survivor MDS may have incorrect linkage for the
removed directory. Later when the MDS recovers, the incorrect linkage
can cause survivor MDS crash.

The fix is include all of directory inode's replicas in rmdir witnesses
list. When receiving a rmdir slave request, MDS who has no auth subtree
in the directory only need to update its cache and send reply (doesn't
need to journal the slave request).

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: skip journaling slave rename when possible

Rename operation can affect three dentries and two inodes. For MDS
who receives rename slave request, but isn't authority of any of
these dentries/inodes and doesn't have any auth subtree under these
dentries/inodes, journaling slave rename can be skipped.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
mds: allow early reply when there is no journaled slave update

Early reply should be Ok when there were slave requests, but none
of them modifies any object.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>