Clock: Using clock_gettime instead of gettimeofday in linux os.

The precision of utime_t is nsec. In func ceph_clock_now, it use
gettimeofday to set utime_t. But the precision of gettimeofday is
microseconds. In linux, the precision of clock_gettime is nsec.
So using clock_gettime install gettimeofday in order to get higer
precision.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
os/FileStore: do not loop in sync_entry on shutdown

Normally we repeat a sync if the journal is full and asks for it or if we
have pending sync waiters.  This isn't for correctness: it's to move things
along quickly.

If we are shutting down *and* the journal is full, however, we currently
can get stuck in a loop where we repeatedly sync.  However, the journal
never gets unfull because we aren't expiring anything.

We tried to fix this in 682b9daacb1960eb60b5f0e9b40d4a3a3e9afd5b but that
didn't work because we don't tell the journal to stop before we shut down
the filestore sync thread.

I'm pretty sure there is another issue in the journal code as

 full_state == FULL_FULL
 submit_manager.op_seq = 14761
 apply_manager.committing_seq = 14761
 apply_manager.committed_seq = 14761

which seems odd.  But I have no longs.  Meanwhile, this fixes the hang.

Fixes: #9545
Signed-off-by: Sage Weil <sage@redhat.com>
shared_cache::add: do not delete value if existed

The method contract specifies that we do not want to delete
value if we are not inserting it, so do not initialize val
at the top of the function to take over value.  No current
users appear to trip over this problem (FDCache and
map_cache).

Signed-off-by: Samuel Just <sam.just@inktank.com>
shared_cache: add purge and tests

purge detaches the lru shared_ptr currently associated from
the key from the lru even if there are still references.

Signed-off-by: Samuel Just <sam.just@inktank.com>
FDCache: purge hoid on clear

We no longer require that a lock on the FD be held for the duration of an
operation, only while accessing the actual index.  We cannot, therefore, assume
that a racing read during lfn_unlink (backfill or scrub) does not still have a
reference to the fd.  We want to remove the fd from the cache to prevent
subsequent operations from finding it while allowing such a racing read to
complete with its existing fd.

Fixes: #9480
Signed-off-by: Samuel Just <sam.just@inktank.com>
ReplicatedPG: writeout hit_set object with correct prior_version

Fixes: #9875
Backport: giant, firefly
Signed-off-by: Samuel Just <sam.just@inktank.com>
Objecter: resend linger ops on any interval change

Watch/notify ops need to be resent after a pg split occurs, as well as
a few other circumstances that the existing objecter checks did not
catch.

Refactor the check the OSD uses for this to add a version taking the
more basic types instead of the whole OSD map, and stash the needed
info when an op is sent.

Fixes: #9806
Backport: giant, firefly, dumpling
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Merge pull request #2798 from athanatos/wip-9875

ReplicatedPG: writeout hit_set object with correct prior_version

Reviewed-by: Sage Weil <sage@redhat.com>
Merge pull request #2799 from athanatos/wip-9480

Wip 9480

Reviewed-by: Sage Weil <sage@redhat.com>
os/LevelDBStore, RocksDBStore: fix race handling for get store size

If we get ENOENT, skip this file, instead of adding in undefined stat
values.

Backport: firefly
Signed-off-by: Sage Weil <sage@redhat.com>
mailmap: Federico Gimenez affiliation

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
cls_rbd_client.cc: reduce scope of variable

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ErasureCodePlugin.cc: reduce scope of variable

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ErasureCodeIsa.cc: reduce scope of variable

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ErasureCodeLrc.cc: reduce scope of variable

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mds/MDS.cc: remove unused local variable

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mds/Server.cc: reduce scope of variable

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
mon/OSDMonitor.cc: reduce scope of variable

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
os/HashIndex.cc: reduce scope of variable

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
os/KeyValueStore.cc: reduce scope of variables

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>