os/FileJournal: stop aio completion thread *after* writer thread

The writer thread may submit a new aio to update the header in its
final moments before shutting down.  Do not stop the aio thread until after
that has happened or else we may not wait for those aio completions.

Signed-off-by: Sage Weil <sage@redhat.com>
Revert "os/FileJournal: For journal-aio-mode, don't use aio when closing journal."

This reverts commit e870fd09ce846e5642db268c33bbe8e2e17ffef2.

The aio completion thread will now wait for the final header update aio to
finish; this workaround is no longer necessary.

Signed-off-by: Sage Weil <sage@redhat.com>
rgw: Export user stats in get-user-info Adminops API

Fixes: #9359

Signed-off-by: Ray Lv <raylv@yahoo-inc.com>
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>
rgw: swift GET / HEAD object returns X-Timestamp field

Fixes: #8911
Backport: giant, firefly, dumpling
Swift clients expect X-Timestamp header, dump it.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
ceph-disk: set guid if reusing a journal partition

When reusing a journal partition (e.g. /dev/sda2) we should set a
new partition guid and link it correctly with the OSD. This way
the journal is symlinked by its persistent name and ceph-disk list
works correctly.

Signed-off-by: Dan van der Ster <daniel.vanderster@cern.ch>
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>
Add AsyncMessenger support

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Remove DispatchQueue in AsyncMessenger

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Add event option

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Add TimeEvent to Event API

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Add STANDBY state process

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Fix Time Event problem

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Add EventCenter stop function

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Replace AsyncConnection* with AsyncconnectionRef

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Add support for mon library

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Add wake up to EventCenter

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Use shared_ptr for EventCallback

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Reconnect when socket is shutdown

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
AsyncMsgr: Fix remote_reset segv

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>