ceph_mon: check for existing mon store before opening db

This will make sure that the monitor data directory is populated before
proceeding to opening it up.  We have to do this in order to work around
leveldb, which will create 'store.db' (even though it won't populate it)
upon opening the database.  Unwillingly, running the monitor without
first issuing a mkfs would have us ending up with a 'store.db' in the
monitor's data directory, and later on we would get errors from the
monitor not finding magic values within the store -- which given mkfs
hadn't been run isn't surprising.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: fix occasional message leak after session reset

Consider:

 - we get a message, put it on a wait list
 - the client session resets
 - we go back to process the message later and discard
   - _ms_dispatch returns false, but nobody drops the msg ref

Since we call _ms_dispatch() a lot internally, we need to always return
true when we are an internal caller.

Fixes: #9176
Backport: firefly, dumpling
Signed-off-by: Sage Weil <sage@redhat.com>
mon: always process the message in dispatch

Nobody should be chained after teh mon, so we can safely drop any message
we don't understand.

Signed-off-by: Sage Weil <sage@redhat.com>
mon: make dispatch(), _ms_dispatch() void

They always return true.

Signed-off-by: Sage Weil <sage@redhat.com>
Merge pull request #2301 from ceph/wip-9176

mon: fix occasional memory leak; clean up dispatch return codes

Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
needs network or it will not start if enabled

example error message: "unable to find any IP address in networks: 10.2.27.0/25", so the service wont start
mds: set l_mds_req on client request

This is one input for the load balancer.

Signed-off-by: Sage Weil <sage@redhat.com>
mds: rename a bunch of metrics

Also clean out a few that were unused and some dead code.

Signed-off-by: Sage Weil <sage@redhat.com>
mds/Server: rename perfcounters

Signed-off-by: Sage Weil <sage@redhat.com>
Fix FTBFS on alpha due to incorrect check on BLKGETSIZE

Ceph FTBFS on Alpha with:

~~~~
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -D__CEPH__ -D_FILE_OFFSET_BITS=64 -D_REENTRANT -D_THREAD_SAFE -D__STDC_FORMAT_MACROS -D_GNU_SOURCE -DCEPH_LIBDIR=\"/usr/lib/alpha-linux-gnu\" -DCEPH_PKGLIBDIR=\"/usr/lib/alpha-linux-gnu/ceph\" -DGTEST_HAS_TR1_TUPLE=0 -D_FORTIFY_SOURCE=2 -I/usr/include/nss -I/usr/include/nspr -Wall -Wtype-limits -Wignored-qualifiers -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char -rdynamic -ftemplate-depth-1024 -Wnon-virtual-dtor -Wno-invalid-offsetof -Wstrict-null-sentinel -g -O2 -Wformat -Werror=format-security -c common/blkdev.cc  -fPIC -DPIC -o common/.libs/blkdev.o
In file included from /usr/include/alpha-linux-gnu/asm/ioctls.h:4:0,
                 from /usr/include/alpha-linux-gnu/bits/ioctls.h:23,
                 from /usr/include/alpha-linux-gnu/sys/ioctl.h:26,
                 from common/blkdev.cc:3:
common/blkdev.cc:13:7: error: missing binary operator before token "int"
 #elif BLKGETSIZE
       ^
~~~~

This error occurs because the value of BLKGETSIZE is tested in a
c-preprocessor conditional compilation test whereas the test should
be for existence.

From: Michael Cree <mcree@orcon.net.nz>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=756892
Signed-off-by: Dmitry Smirnov <onlyjob@member.fsf.org>
common: remove spurious uint32_t in buffer.c

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
rbd: fix signess warning

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
common/RWLock: track read/write locks via atomics for assertion checks

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
common/RWLock: check return values

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
common/RWLock: add get()

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
common/RWLock: add explicit unlock() to *Lockers

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
common/RWLock: add lock context

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
time: create RWTimer

a timer implementation that uses RWLock

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
client: adapt to new objecter interface

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
mds: adapt to new objecter interface

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>