Sage Weil [Thu, 1 Dec 2016 16:57:17 +0000 (11:57 -0500)]
ceph_test_objectstore: fix Rename test
We were doing a no-op setattr here, even though the intenral
ENOENT used to be ignored, because it previously triggered a
bug in bluestore. We're no longer ignoring that internal
error, though, as of 6ecb44f0c6216f3fb29b384a2d10c7d33bf1d19c,
so remove this part of the test.
Jeff Layton [Wed, 30 Nov 2016 12:37:52 +0000 (07:37 -0500)]
test/libcephfs: ensure that we set the mode of the libcephfs root before testing
Patrick noticed that the libcephfs tests failed to run unless they were
run after the ceph-fuse tests had run. The ceph-fuse tests set the root
of the share to mode 01777, but the libcephfs tests don't do that even
though they rely on the directory being world-writable.
Fix this by adding a new main() function for ceph_test_libcephfs, and
calling a function (copied from access.cc) that resets the permissions
of the root before running the tests.
Fixes: http://tracker.ceph.com/issues/18013 Signed-off-by: Jeff Layton <jlayton@redhat.com>
Jeff Layton [Wed, 30 Nov 2016 12:37:52 +0000 (07:37 -0500)]
client: fix some potential locking problems in InodeRef handling
As Zheng points out, declaring an InodeRef before you take the mutex
means that its destructor gets called after the mutex has already been
released. Handling the refcount however, requires that you hold the
mutex so this could cause refcount leaks if two threads do a
load/decrement/store at the same time. Reverse the order.
Adding a fixes line here for the currently reported bug, but it's
not yet clear whether this will fix it.
Fixes: http://tracker.ceph.com/issues/17982 Signed-off-by: Jeff Layton <jlayton@redhat.com>
Sage Weil [Wed, 30 Nov 2016 03:55:11 +0000 (22:55 -0500)]
osdc/Objecter: fix relock race
In commit a863ae1c0fab636eabced0979889cbb3be74bf74 we tried
to fix a race but failed because we didn't update the
session pointer. Add a proper test for this case with
a delay injection and fix the bug.
Fixes: http://tracker.ceph.com/issues/17942 Signed-off-by: Sage Weil <sage@redhat.com>
RGWBucketSyncStatusManager was creating its own RGWAsyncRadosProcessor
and failing to clean it up on destruction. A recent change turned
global_init()'s return value into an intrusive_ptr to guarantee that our
CephContext is freed, and this triggered an assertion that all worker
threads were shut down
Bassam Tabbara [Sat, 5 Nov 2016 01:10:08 +0000 (18:10 -0700)]
embedded: Add RADOS classes to embedded cephd library
RADOS classes can now be statically compiled and added to
the embedded cephd library.
The RADOS ClassHandler now has an option to skip calling dlclose
just like PluginRegistry.
All RADOS classes where changed to use a CLS_INIT macro that
will either use __cls_init or classname_cls_init. this enables
the static compiling of all RADOS classes in a single library. Also
global method definitions where moved to inside cls_init.
Also added a few aconfig defines including WITH_EMBEDDED, WITH_CEPHFS,
WITH_RBD, and WITH_KVS. Note that WITH_RBD was not defined before
and the ceph-dencoder was broken when it was turned on.
Bassam Tabbara [Sat, 5 Nov 2016 01:10:08 +0000 (18:10 -0700)]
embedded: Add librbd and librados to embedded ceph
This commit add librados, librbd to the embedded ceph static library. This is needed to support daemons built with libcephd that want to run mon commands, create rbd volumes, snapshots etc.
Bassam Tabbara [Sat, 5 Nov 2016 01:10:08 +0000 (18:10 -0700)]
embedded: Add a skeleton libcephd library
libcephd is a library that contains ceph daemon code
that can be statically linked in other applications.
Added MergeStaticLibraries.cmake that can merge static libraries
to form a bigger one. This approach avoids the need to mess with
STATIC libraries all over the code base.
Sage Weil [Tue, 29 Nov 2016 03:47:53 +0000 (22:47 -0500)]
librbd/ImageCtx: no need for virtual dtor
CID 1396232 (#1 of 1): Non-virtual destructor (VIRTUAL_DTOR)
1. nonvirtual_dtor: Class librbd::<unnamed>::SafeTimerSingleton has a destructor and a pointer to it is upcast to class SafeTimer which doesn't have a virtual destructor.
The SafeTimerSingleton is not polymorphic; no need for
a virtual dtor.
Sage Weil [Mon, 28 Nov 2016 20:56:29 +0000 (15:56 -0500)]
os/bluestore/KernelDevice: fix race in aio_thread vs aio_wait
The caller is free to destroy the aio vector contents
once aio_wait completes. This is exactly what
BlueFS::_fsync() does. Delay the num_running dec
(which is what aio_wait waits for) until after we've
examined the aios.
Fixes: http://tracker.ceph.com/issues/17824 Signed-off-by: Sage Weil <sage@redhat.com>
Sage Weil [Mon, 28 Nov 2016 19:26:51 +0000 (14:26 -0500)]
os/Transaction: add missing break
CID 1395137 (#1 of 1): Missing break in switch (MISSING_BREAK)
unterminated_case: The case for value ObjectStore::Transaction::OP_TRY_RENAME is not terminated by a 'break' statement.
Sage Weil [Mon, 28 Nov 2016 19:26:21 +0000 (14:26 -0500)]
os/ObjectStore: pass by ref to clone
CID 1395658 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE)
pass_by_value: Passing parameter noid of type ghobject_t (size 144 bytes) by value.
Sage Weil [Mon, 28 Nov 2016 19:25:39 +0000 (14:25 -0500)]
os/ObjectStore: pass by ref to clone_range
CID 1395650 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE)
pass_by_value: Passing parameter noid of type ghobject_t (size 144 bytes) by value.
Sage Weil [Mon, 28 Nov 2016 19:24:57 +0000 (14:24 -0500)]
os/ObjectStore: add missing break
CID 1394998 (#1 of 1): Missing break in switch (MISSING_BREAK)
unterminated_case: The case for value ObjectStore::Transaction::OP_TRY_RENAME is not terminated by a 'break' statement.
Sage Weil [Mon, 28 Nov 2016 19:23:36 +0000 (14:23 -0500)]
os/bluestore: be pedantic about kv_stop locking
Makes coverity happy.
CID 1395346 (#1 of 1): Data race condition (MISSING_LOCK)
1. missing_lock: Accessing this->kv_stop without holding lock BlueStore.kv_lock. Elsewhere, "BlueStore.kv_stop" is accessed with BlueStore.kv_lock held 1 out of 2 times (1 of these accesses strongly imply that it is necessary).
Sage Weil [Mon, 28 Nov 2016 19:22:32 +0000 (14:22 -0500)]
os/bluestore: init all fields
9. uninit_member: Non-static class member block_size is not initialized in this constructor nor in any functions that it calls.
11. uninit_member: Non-static class member block_mask is not initialized in this constructor nor in any functions that it calls.
13. uninit_member: Non-static class member block_size_order is not initialized in this constructor nor in any functions that it calls.
CID 1396159 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
15. uninit_member: Non-static class member max_alloc_size is not initialized in this constructor nor in any functions that it calls.
Sage Weil [Mon, 28 Nov 2016 19:15:33 +0000 (14:15 -0500)]
os/bluestore: pass by ref to _collection_list
CID 1395617 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE)
pass_by_value: Passing parameter end of type ghobject_t (size 144 bytes) by value.
pass_by_value: Passing parameter start of type ghobject_t (size 144 bytes) by value.
Sage Weil [Mon, 28 Nov 2016 19:11:54 +0000 (14:11 -0500)]
os/bluestore/BlueRocksEnv: fix strerror args
CID 1395399 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: A negative constant -2 is passed as an argument to a parameter that cannot be negative.
Sage Weil [Mon, 28 Nov 2016 19:09:45 +0000 (14:09 -0500)]
os/bluestore/BlueFS: init iocv
CID 1396119 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
2. uninit_member: Non-static class member field iocv._M_elems is not initialized in this constructor nor in any functions that it calls.
Sage Weil [Mon, 28 Nov 2016 18:45:35 +0000 (13:45 -0500)]
os/bluestore/BlueFS: check flush result
CID 1394759 (#1 of 1): Unchecked return value (CHECKED_RETURN)
20. check_return: Calling _flush without checking return value (as is done elsewhere 4 out of 5 times).
Sage Weil [Mon, 28 Nov 2016 18:44:05 +0000 (13:44 -0500)]
os/bluestore/BlockDevice: init rotational
CID 1396126 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
2. uninit_member: Non-static class member rotational is not initialized in this constructor nor in any functions that it calls.
"ceph-disk trigger" invocation is currently performed in a mutually
exclusive fashion, with each call first taking an flock on the path
/var/lock/ceph-disk. On systems with a lot of osds, this leads to a
large amount of lock contention during boot-up, and can cause some
service instances to trip the 120 second timeout.
Take an flock on a device specific path instead of /var/lock/ceph-disk,
so that concurrent "ceph-disk trigger" invocations are permitted for
independent osds. This greatly reduces lock contention and consequently
the chance of service timeout. Per-device concurrency restrictions
required for http://tracker.ceph.com/issues/13160 are maintained.
Fixes: http://tracker.ceph.com/issues/18049 Signed-off-by: David Disseldorp <ddiss@suse.de>