Danny Al-Gaaf [Wed, 1 Oct 2014 21:08:15 +0000 (23:08 +0200)]
BtrfsFileStoreBackend.cc: fix string overflow
Use strncpy() instead of strcpy and make sure the result
is '\0' terminated.
Fix for:
CID 1063700 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
fixed_size_dest: You might overrun the 4088 byte fixed-size string
vol_args.name by copying the return value of c_str without checking
the length.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
shutdown() resets initialized to 0, but we can still receive messages
after this point, so fix message handlers to skip messages in this
case instead of asserting.
Also read initialized while holding Objecter::rwlock to avoid races
where e.g. handle_osd_map() checks initialized -> 1, continues,
shutdown() is called, sets initialized to 0, then handle_osd_map()
goes about its business and calls op_submit(), which would fail the
assert(initialized.read()) check. Similar races existed in other
message handlers which change Objecter state.
The Objecter is not destroyed until after its Messenger in
the MDS, OSD, and librados, so this should be safe.
Danny Al-Gaaf [Wed, 1 Oct 2014 15:01:17 +0000 (17:01 +0200)]
client/SyntheticClient.cc: remove dead code
Fix for:
const: At condition do_sync, the value of do_sync must be equal to 0.
dead_error_condition: The condition do_sync cannot be true.
CID 716893 (#1 of 1): Logically dead code (DEADCODE)
dead_error_begin: Execution cannot reach this statement op.OSDOp()
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Thu, 25 Sep 2014 11:34:47 +0000 (13:34 +0200)]
LogEntry.h: init LogEntry::prio in constructor
CID 1240202 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
uninit_member: Non-static class member prio is not initialized
in this constructor nor in any functions that it calls.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Sage Weil [Mon, 29 Sep 2014 23:11:06 +0000 (16:11 -0700)]
osd: do not bind ms_objecter messenger
The objecter messenger is only used as a client to initiate client-side
connections to other OSDs. It doesn't need to bind to a port.
This was added in 558d9fc956204b7a18001b148e171b893cb63d85 to push client
traffic to the cluster interface. This doesn't actually help/work because
we are still connecting to our peers' client-facing addresses.
qa/workunits/cephtool/test.sh: fix thrash (ultimate)
Keep the osd trash test to ensure it is a valid command but make it a
noop by giving it a zero argument (meaning thrash 0 OSD maps).
Remove the loops that were added after the command in an attempt to wait
for the cluster to recover and not pollute the rest of the tests. Actual
testing of osd thrash would require a dedicated cluster because it the
side effects are random and it is unnecessarily difficult to ensure they
are finished.
librados: cap the IoCtxImpl::{aio_}*{write,append} buffer length
If the value of the len parameter is greater than UINT_MAX/2,
IoCtxImpl::aio_write, IoCtxImpl::aio_write_full, IoCtxImpl::aio_append,
IoCtxImpl::write, IoCtxImpl::append will fail with E2BIG.
IoCtxImpl::write_full is the exception because it does not have a
length argument to check.
./ceph_test_rados_api_aio --gtest_filter=LibRadosAio.E2BIG
Running main() from gtest_main.cc
Note: Google Test filter = LibRadosAio.E2BIG
[==========] Running 0 tests from 0 test cases.
[==========] 0 tests from 0 test cases ran. (0 ms total)
[ PASSED ] 0 tests.
Jianpeng Ma [Sun, 28 Sep 2014 07:01:46 +0000 (15:01 +0800)]
osd: Make RPGTransaction::get_bytes_written return the correct size.
It record size larger than clien wrote. It should like
ECTransaction::get_bytes_written only return the size which clien
wrote. It should contain omap data.
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
librados: cap the rados*{write,append} buffer length
When the caller submits a payload that will end up being rejected with
rados.Error: Ioctx.write(rbd): failed to write hw: errno EMSGSIZE
it is stored in a bufferlist whose length is an unsigned int. If the
value of the len parameter is greater than UINT_MAX/2, rados_write,
rados_write_full and rados_append will fail with E2BIG.
Multiple calls to rados_write or rados_append can fill objects larger
than UINT_MAX/2.
Johnu George [Wed, 24 Sep 2014 16:32:50 +0000 (09:32 -0700)]
Crush: Ensuring at most num-rep osds are selected
Crush temporary buffers are allocated as per replica size configured
by the user.When there are more final osds (to be selected as per
rule) than the replicas, buffer overlaps and it causes crash.Now, it
ensures that at most num-rep osds are selected even if more number of
osds are allowed by the rule.
Fixes: #9492 Signed-off-by: Johnu George <johnugeo@cisco.com>
Sage Weil [Thu, 25 Sep 2014 19:34:11 +0000 (12:34 -0700)]
osdc/Objecter: only post_rx_buffer if no op timeout
If we post an rx buffer and there is a timeout, the revocation can happen
while the reader has consumed the buffers but before it has decoded and
constructed the message. In particular, we calculate a crc32c over the
data portion of the message after we've taken the buffers and dropped the
lock.
Instead of fixing this race (for example, by reverifying rx_buffers under
the lock while calculating the crc.. bleh), just skip the rx buffer
optimization entirely when a timeout is present.
Note that this doesn't cover the op_cancel() paths, but none of those users
provide static buffers to read into.
Fixes: #9582
Backport: firefly, dumpling Signed-off-by: Sage Weil <sage@redhat.com>
erasure-code: test isa encode/decode with various object sizes
Create an encode_decode() helper method to be called from the
encode_decode test function with various object size arguments. The
helper method is a copy/paste of the previous test that was using a
single object of a fixed size. The test is slightly adapted to
accommodate for different object sizes but the logic is not modified.
The object sizes being tested are chosen to be under the size of the
required size alignment or on multiple pages, size aligned or not.
John Spray [Thu, 25 Sep 2014 16:01:10 +0000 (17:01 +0100)]
msg: allow calling dtor immediately after ctor
Asserting on reaper_stop only made sense if the
messenger had ever been started: as it stood,
one couldn't create and destroy a messenger
without also starting and stopping it.
erasure-code: isa encode tests adapted to per chunk alignment
The encode tests use the alignment constraints. It has been changed to
be aligned on a per chunk basis instead of computing a more expensive
object alignement constraint. The test function is modified to take the
change into account but the logic is otherwise unmodified.