Commit Graph

184 Commits

Author SHA1 Message Date
Yan Jun
0cfd05db57 osd: cleanups
Signed-off-by: Yan Jun <yan.jun8@zte.com.cn>
2017-07-13 22:22:20 +08:00
Dan Mick
9a5954fc66 global/global_init.cc global_pre_init: look for ENOENT
EINVAL for no conf file found changes to ENOENT

Signed-off-by: Dan Mick <dan.mick@redhat.com>
2017-04-24 23:34:27 -07:00
Willem Jan Withagen
e8f03e205d core: Prefix /proc/ with FreeBSD emulation
Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
2017-04-05 21:36:22 +02:00
Sage Weil
eda8d28c37 Merge pull request #13687 from Liuchang0812/wip-19106-eliminate-unsafe-option
common/config: eliminate config_t::set_val unsafe option

Reviewed-by: Sage Weil <sage@redhat.com>
2017-03-28 10:45:01 -05:00
Sage Weil
3d3d2def66 Merge pull request #14096 from baiyanchun/remove_useless_parameter
common: remove useless parameter

Reviewed-by: Kefu Chai <kchai@redhat.com>
Reviewed-by: Pan Liu <liupan1111@gmail.com>
2017-03-24 16:41:18 -05:00
baiyanchun
83803de347 common: remove useless parameter
Signed-off-by: baiyanchun <yanchun.bai@istuary.com>
2017-03-23 10:38:15 +08:00
liuchang0812
a417818e82 common/global: refactor global_init to avoid setuser/setgroup modification
Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
2017-03-22 21:16:50 +08:00
liuchang0812
b5582dda23 common: convert plugin_dir and erasure_plugin_dir to SAFE_OPTION
Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
2017-03-21 23:03:13 +08:00
liuchang0812
cddc01d9b4 common/config: eliminate config_t::set_val unsafe option
Fixes: http://tracker.ceph.com/issues/19106

Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
2017-03-21 19:35:25 +08:00
liuchang0812
288924338a common: add override in header file
Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
2017-03-03 19:21:44 +08:00
liuchang0812
da109b3139 common: add override for common submodule and misc
Fixes: http://tracker.ceph.com/issues/18922

Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
2017-02-16 13:32:22 +08:00
Kefu Chai
8a86a3fd85 Merge pull request #12878 from tchaikov/wip-cmake
cmake: link ceph-{mgr,mon,mds,osd} against libcommon statically

Reviewed-by: Casey Bodley <cbodley@redhat.com>
2017-01-26 23:59:36 +08:00
Kefu Chai
4ea38df656 cmake: link ceph-{mds,mgr,mon,osd} against libcommon
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>
2017-01-20 17:56:28 +08:00
songbaisen
dec321939c global: we need to handle the init_on_startup return value when global_init.
Signed-off-by:song baisen <song.baisen@zte.com.cn>
2017-01-20 07:57:18 +00:00
Yuri Weinstein
12a1e20721 Merge pull request #12925 from liewegas/wip-crypto-shutdown-fixes
common: misc fixes detected by crypto shutdown assert

Reviewed-by: Brad Hubbard <bhubbard@redhat.com>
2017-01-16 13:07:32 -08:00
Sage Weil
4a3c59a53e global/signal_handler: dump backtrace even from within logging code
We can dump the backtrace regardless of where we hit the assertion.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-01-13 11:40:53 -05:00
Sage Weil
d1cc9e4836 global/signal_handler: behave if g_ceph_context or _log are null
This can happen if we trigger an assertion while g_ceph_context is being
torn down.

Signed-off-by: Sage Weil <sage@redhat.com>
2017-01-13 11:40:53 -05:00
Kefu Chai
8f7643792c cmake: turn libcommon into a shared library
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>
2017-01-10 21:10:53 +08:00
Adam C. Emerson
b9182564c7 dout: Use dout_context
As a transition for g_ceph_context removal, make all dout macros depends
on a local macro.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2016-12-22 13:55:37 -05:00
Sage Weil
03e87016bb Merge pull request #12148 from tchaikov/wip-scan-build-fixes
scan build fixes

Reviewed-by: Sage Weil <sage@redhat.com>
2016-11-28 16:21:08 -05:00
Kefu Chai
cb1cda9671 common,test: g_ceph_context->put() upon return
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>
2016-11-24 22:38:28 +08:00
Kefu Chai
1f0abeffa7 global/signal_handler: retry if read() returns with EINTR
this silences the warning of

Value stored to 'r' is never used.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-11-23 14:52:18 +08:00
Sage Weil
12f6e8f18a mempool: attach mempool asok commands to all ccts
Signed-off-by: Sage Weil <sage@redhat.com>
2016-11-11 14:59:53 -05:00
Sage Weil
328487b6e1 mempool: move to libcommon
Signed-off-by: Sage Weil <sage@redhat.com>
2016-11-11 14:59:53 -05:00
Haomai Wang
eae7d5a645 msg/async: add dpdk stack plugin
Signed-off-by: Haomai Wang <haomai@xsky.com>
2016-11-09 11:39:20 +08:00
Sage Weil
9cecff8d18 mempool: use function static for pool table
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>
2016-11-02 13:48:49 -04:00
Sage Weil
ebf052762e mempool: do not dump unused pools
Notably, unittest_[12]. :)

Signed-off-by: Sage Weil <sage@redhat.com>
2016-11-02 13:48:49 -04:00
Sage Weil
a54d21749d mempool: put pool namespaces within mempool::
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
2016-11-02 13:48:49 -04:00
Sage Weil
b15a377a7b mempool: simplify debug settings
There's no need for a per-pool debug flag; just use the global
debug_mode bool!

Signed-off-by: Sage Weil <sage@redhat.com>
2016-11-02 13:48:49 -04:00
Sage Weil
bfeaed6412 mempool: simplify initialization
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>
2016-11-02 13:48:49 -04:00
Sage Weil
049797641b mempool: dynamic index by type in pool_t
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>
2016-11-02 13:48:49 -04:00
Sage Weil
a6eec64c95 mempool: pick shard on every allocation; move types to pool_t
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>
2016-11-02 13:48:49 -04:00
Sage Weil
735be3662f include/mempool: rename containers -> types
Signed-off-by: Sage Weil <sage@redhat.com>
2016-11-02 13:48:48 -04:00
Sage Weil
81295c61c4 global: introduce mempool_debug config option, asok command
Signed-off-by: Sage Weil <sage@redhat.com>
2016-11-02 13:47:44 -04:00
Sage Weil
9cbacc81cc include/mempool: introduce mempool infrastructure
This is heavily based on Allen Samuels' prototype.

Signed-off-by: Sage Weil <sage@redhat.com>
2016-11-02 13:47:44 -04:00
Kefu Chai
e7291ce22c Merge pull request #9304 from dzafman/wip-13937
osd: handle EC recovery read errors

Reviewed-by: Samuel Just <sjust@redhat.com>
Reviewed-by: Loic Dachary <ldachary@redhat.com>
Reviewed-by: Kefu Chai <kchai@redhat.com>
2016-10-28 17:21:09 +08:00
David Zafman
c6cf05b302 global: Always log loading erasure code for tests
Fix for broken test-erasure-code.sh and test-erasure-eio.sh

Signed-off-by: David Zafman <dzafman@redhat.com>
2016-10-27 22:42:11 -07:00
Patrick Donnelly
ff0e521434
core: set dumpable flag after setuid
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>
2016-10-20 14:19:06 -04:00
Bassam Tabbara
e7e0b1bc1e erasure-code: Backward compatibility with legacy EC plugins
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>
2016-09-29 10:34:34 -07:00
Sage Weil
fba798dcad remove autotools
Signed-off-by: Sage Weil <sage@redhat.com>
2016-09-07 11:50:14 -04:00
Kefu Chai
44bcd269d0 Merge pull request #10516 from wjwithagen/wip-wjw-freebsd-pidfile
src/global/pidfile.cc: Assign elements in structures individually

Reviewed-by: Kefu Chai <kchai@redhat.com>
2016-08-19 11:58:15 +08:00
Kefu Chai
e354918ec8 Merge pull request #10264 from yuyuyu101/wip-async-abstract-backend
msg/async: allow other async backend implementations

Reviewed-by: Kefu Chai <kchai@redhat.com>
2016-08-17 02:18:39 +08:00
Haomai Wang
524553ff31 common/ceph_context: add prefork/postfork wathcher support
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>
2016-08-16 23:19:25 +08:00
John Coyle
fffcd6e523 global/signal_handler: use sig_str instead of sys_siglist
musl libc does not provide sys_siglist[]

Signed-off-by: John Coyle <dx9err@gmail.com>
2016-08-09 13:39:15 -04:00
Willem Jan Withagen
4c9a231739 src/global/pidfile.cc: Assign elements in structures individually
- 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>
2016-07-31 23:08:16 +02:00
Kefu Chai
a27bbaaebf cmake: link libcommon against pthread
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>
2016-07-30 00:26:44 +08:00
Kefu Chai
4e8e68aa48 Merge pull request #9371 from ukernel/wip-osx-fuse
build ceph-fuse on OSX

Reviewed-by: Kefu Chai <kchai@redhat.com>
2016-07-27 20:19:04 +08:00
Yuri Weinstein
71f393d786 Merge pull request #10345 from tchaikov/wip-dump-cmdline
global/signal_handler: dump cmdline instead of arg[0]

Reviewed-by: xie xingguo <xie.xingguo@zte.com.cn>
2016-07-26 15:47:18 -07:00
Kefu Chai
741f99073c cmake: restructure src/CMakeLists.txt in a more hierarchical way
Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-07-19 22:23:12 +08:00
Kefu Chai
71cdedcee8 global/signal_handler: dump cmdline instead of arg[0]
Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-07-19 18:04:30 +08:00