add a static library named global-static, which does not link with
libceph-common. so the executables which does not link against
lib{rados,cephfs,rbd} can be linked against global-static instead if
they want to access the symbols previously available from libglobal.
and libglobal is now linked against libceph-common. and it is supposed
to be used by executables packaged by ceph-test. these exectuables can
safely depend on libceph-common offered by package of "librados2".
Signed-off-by: Kefu Chai <kchai@redhat.com>
prior to this change, libcommon is a convenient library which gets
linked into librados, librbd and libcephfs and all ceph executables.
this incurs some problems:
- double dose of libcommon in memory space and HDD: waste of memory
and disk space.
- if an application links to two libraries including libcommon at the
same time. take librados and libcephfs as an example, they could
interfere with each other by changing the other guy's status.
after this change, libcommon is tuned into a shared library and
renamed to libceph-common. it will be installed into $prefix/lib/ceph,
and packaged in librados2.
ceph.spec.in,debian/librados2.install: package libceph-common in
librados2.
CMakeLists.txt:
- do not link against libboost-* if not necessary.
- s/common/ceph-common/g
- install libceph-common into $prefix/lib/ceph
- set rpath to $prefix/lib/ceph
- link against ceph-common if an executable needs access to non public
symbols in ceph.
Signed-off-by: Kefu Chai <kchai@redhat.com>
prior to this change, global_init() could create a new CephContext
and assign it to g_ceph_context. it's our responsibilty to release
the CephContext explicitly using cct->put() before the application
quits. but sometimes, we fail to do so.
in this change, global_init() will return an intrusive_ptr<CephContext>,
which calls `g_ceph_context->put()` in its dtor. this ensures that
the CephContext is always destroyed before main() returns. so the
log is flushed before _log_exp_length is destroyed.
there are two cases where global_pre_init() is called directly.
- ceph_conf.cc: g_ceph_context->put() will be called by an intrusive_ptr<>
deleter.
- rgw_main.cc: global_init() is called later on on the success code
path, so it will be taken care of.
Fixes: http://tracker.ceph.com/issues/17762
Signed-off-by: Kefu Chai <kchai@redhat.com>
The compiler/linker guarantee this is initialized before any invocation
of this function... even if it is by a ctor in another compilation unit
that is initialized by the mempool.cc compilation unit.
Suggested by Bartłomiej Święcki <bartlomiej.swiecki@corp.ovh.com>
Signed-off-by: Allen Samuels <allen.samuels@sandisk.com>
e.g., mempool::bluestore_meta_other::list<...> ...
This avoids colliding with other names and types when the pool
name is something common (like "osd").
Signed-off-by: Sage Weil <sage@redhat.com>
# Conflicts:
# src/include/mempool.h
Assume that the array will be zeroed when the process starts, and
avoid the possibility that it will be zeroed *again* when the
ctors run for this link module (potentially clobbering values
that have been filled in by other ctors who ran earlier than
ours).
Signed-off-by: Sage Weil <sage@redhat.com>
This avoids having to use statics for the pool_allocators and
guessing what intenral types the containers are going to need.
It'll be a bit slower in debug on on construction and destruction,
but who cares!
Signed-off-by: Sage Weil <sage@redhat.com>
If we have a static choice of shard for every *type*
(pool_allocator_base_t) then we will hammer that shard from all
threads and play cacheline ping-pong. Instead, move the types
list to pool_t (there aren't that many anyway) and pick a shard
on every allocate/deallocate call.
Signed-off-by: Sage Weil <sage@redhat.com>
When ceph-* drops drops privileges via setuid, core dumps are no longer
generated because its DUMPABLE flag is cleared. We have to manually
turn that back on.
From prctl(2):
Normally, this flag is set to 1. However, it is reset to the current value contained in the file /proc/sys/fs/suid_dumpable (which by default has the value 0), in the fol‐
lowing circumstances:
* The process's effective user or group ID is changed.
* The process's filesystem user or group ID is changed (see credentials(7)).
* The process executes (execve(2)) a set-user-ID or set-group-ID program, or a program that has capabilities (see capabilities(7)).
Fixes: http://tracker.ceph.com/issues/17650
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
Resurrected jerasure_generic, jerasure_sse3, jerasure_sse4, jerasure_neon,
shec_generic, shec_sse3, shec_sse4 and shec_neon. These all are exact
copies of the new jerasure and shec plugins that support SIMD detection.
Moved EC preload code in ceph-mon and ceph-osd to a central location, added
warning when preloading legacy plugins.
OSMonitor::get_erasure_code and OSDMonitor:normalize_profile will now check
if legacy EC plugins are used and log a warning.
Added tests to check that warnings make it to the log.
Signed-off-by: Bassam Tabbara <bassam.tabbara@quantum.com>
Because daemon() will termniate all existing threads, it will make something go
wrong.
So we want to add hook at CephContext, do something before/after fork.
Signed-off-by: Haomai Wang <haomai@xsky.com>
- Assigning structure is better per element.
The order of elements is not always the same in very OS.
So "hardcoding" can/will assign to the wrong elements
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
as Thread.cc lives in libcommon, and global is not using libpthread
directly. so moving libpthread linkage from libglobal to libcommon.
Signed-off-by: Kefu Chai <kchai@redhat.com>