Sage Weil [Wed, 3 Jun 2015 18:57:34 +0000 (14:57 -0400)]
upstart: limit respawn to 3 in 30 mins (instead of 5 in 30s)
It may take tens of seconds to restart each time, so 5 in 30s does not stop
the crash on startup respawn loop in many cases. In particular, we'd like
to catch the case where the internal heartbeats fail.
This should be enough for all but the most sluggish of OSDs and capture
many cases of failure shortly after startup.
Fixes: #11798 Signed-off-by: Sage Weil <sage@redhat.com>
Loic Dachary [Sun, 17 May 2015 22:06:06 +0000 (00:06 +0200)]
erasure-code: verify the profile content matches get_profile()
The profile stored by the plugin may be different from the one set by
the user: it includes defaults. When the plugin is initialized, the
profile is modified to include the default values. Verify that the
modified profile matches what the get_profile() method returns, to guard
against inconsistencies from the erasure code plugin implementation.
Loic Dachary [Sun, 17 May 2015 21:53:42 +0000 (23:53 +0200)]
mon: normalize erasure-code profile for storage and comparison
An erasure-code profile set by the user may be modified by the erasure
code plugin, most of the time to add default values for domain failure,
techniques etc.
Whenever the monitor gets an erasure code profile from the user or the
configuration file, it uses it to initialize the corresponding erasure
code plugin and:
* validate the profile and get an error if it is invalid
* get a normalized profile
The normalized profile is stored in the OSDMap. Should the user try
to set the same erasure code profile with the different values that lead
to the same normalized form, the modification will be accepted as a
noop, as if the same values were given. For instance:
ceph osd erasure-code-profile set myprofile k=2
ceph osd erasure-code-profile set myprofile k=2 m=1
are the same because the default value for m is 1 for the default
jerasure plugin.
If the normalized form is not used for storage and comparison, the
second call with m=1 will fail and require --force to override
myprofile, although the user can read from the documentation that it
matches the default value.
Loic Dachary [Mon, 1 Jun 2015 17:50:05 +0000 (19:50 +0200)]
erasure-code: implement get_profile for every plugins
The ErasureCode::init function is implemented to store the profile and
is called by the init method of each plugin. The
ErasureCode::get_profile function is implemented to return the profile
that was stored. A specialized ostream<< function is implemented to
facilitate the display of the profile.
Loic Dachary [Mon, 1 Jun 2015 17:46:50 +0000 (19:46 +0200)]
erasure-code: expect all plugins to implement get_profile
Add the get_profile method to the interface and make it a pure virtual.
Each plugin is expected to return the profile currently in use. Although
the profile is also stored in the OSDMap, it provides a convenient
introspection method to validate that the profile being set is indeed
the profile being used.
Danny Al-Gaaf [Wed, 6 May 2015 15:09:08 +0000 (17:09 +0200)]
mds/CInode.cc: fix FORWARD_NULL issue
Don't check for the conditions used inside get_projected_parent_dn(),
simply check if the returned value is valid.
Fix for:
CID 716915: Dereference after null check (FORWARD_NULL)
var_deref_model: Passing null pointer this->get_projected_parent_dn()
to pre_dirty, which dereferences it.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Wed, 6 May 2015 13:45:01 +0000 (15:45 +0200)]
os/HashIndex.cc: add asserts to prevent BAD_SHIFT
Fix for:
CID 1232599: Bad bit shift operation (BAD_SHIFT)
negative_shift: In expression i << (4 - split_bits) % 4, shifting by
a negative amount has undefined behavior. The shift amount,
(4 - split_bits) % 4, is -1.
CID 1232600: Bad bit shift operation (BAD_SHIFT)
negative_shift: In expression 1 << pg_num_bits - 1, shifting by a
negative amount has undefined behavior. The shift amount,
pg_num_bits - 1, is -1.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Tue, 5 May 2015 12:38:04 +0000 (14:38 +0200)]
osd/ClassHandler.cc: fix STRING_OVERFLOW
CID 1058792 (#1 of 1): Copy into fixed size buffer (STRING_OVERFLOW)
fixed_size_dest: You might overrun the 4097 byte fixed-size string
cname by copying &pde->d_name[8UL] - 1 without checking the length.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Tue, 5 May 2015 12:29:14 +0000 (14:29 +0200)]
test/librbd/fsx.cc: fix BUFFER_SIZE_WARNING
CID 1296375 (#1 of 1): Buffer not null terminated (BUFFER_SIZE_WARNING)
buffer_size_warning: Calling strncpy with a maximum size argument of
1024 bytes on destination array logfile of size 1024 bytes might leave
the destination string unterminated.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Mon, 4 May 2015 23:59:56 +0000 (01:59 +0200)]
tools/rados/rados.cc: restore ostream precision format
CID 717135 (#1 of 1): Not restoring ostream format (STREAM_FORMAT_STATE)
1. format_changed: precision changes the format state of std::cout for
category precision.
4. end_of_path: Changing format state of stream std::cout for category
precision without later restoring it.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Mon, 4 May 2015 23:54:06 +0000 (01:54 +0200)]
tools/rados/rados.cc: restore ostream precision format
CID 717134 (#1 of 1): Not restoring ostream format (STREAM_FORMAT_STATE)
4. format_changed: precision changes the format state of std::cout
for category precision.
26. end_of_path: Changing format state of stream std::cout for category
precision without later restoring it.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Mon, 4 May 2015 23:44:05 +0000 (01:44 +0200)]
tools/rados/rados.cc: restore ostream format
CID 717133 (#1 of 1): Not restoring ostream format (STREAM_FORMAT_STATE)
95. format_changed: fill changes the format state of std::cout for
category fill.
100. end_of_path: Changing format state of stream std::cout for
category fill without later restoring it.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf [Mon, 4 May 2015 17:59:30 +0000 (19:59 +0200)]
mds/MDS.cc: silence coverity DIV_BY_ZERO
Silence coverity: ls.empty() check should already imply that
ls.size() != 0.
CID 1295402 (#1 of 1): Division or modulo by zero (DIVIDE_BY_ZERO)
divide_by_zero: In expression rand() % ls.size(), modulo by
expression ls.size() which may be zero has undefined behavior.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Loic Dachary [Sun, 31 May 2015 13:18:35 +0000 (15:18 +0200)]
tests: cephtool/test.sh wait_for_clean after PG (re)mapping
A get/set command may fail with
Error EBUSY: currently creating pgs, wait
if issued before the PGs are clean. Call wait_for_clean after the pool
is created or a pool setting is changed and remaps the PGs it
contains (size, pg_num...) to ensure the PGs are clean and the set/get
command that follow will succeed.
Loic Dachary [Sun, 17 May 2015 16:09:21 +0000 (18:09 +0200)]
erasure-code: ErasureCodeShec update default values to string
Update the ErasureCodeShec::init function to use string default
values. The default profile values for technique, ruleset-root and
ruleset-failure-domain are set for the user to see.
The error message when an invalid technique is provided is written to
the error stream to be returned to the user instead of being written to
the OSD log.
Updating other values from the profile would require deeper changes and
is left for later.
Loic Dachary [Sun, 17 May 2015 16:08:31 +0000 (18:08 +0200)]
erasure-code: ErasureCodeLrc update default values to string
Update the ErasureCodeLrc::init function to use string default values
and update the profile accordingly.
If the k,m,l values are set and generate mappings and layers entries,
those are not stored in the profile. The details of what k,m,l create
are private and not exposed to the caller.
Loic Dachary [Sun, 17 May 2015 15:58:36 +0000 (17:58 +0200)]
erasure-code: ErasureCodeIsa update default values to string
Update the ErasureCodeIsa::init function to use string default values
and update the profile accordingly.
Also fix a bug by which the plugin would incorrectly report using the
default technique when the reed_sol_van or cauchy techniques are the
only legitimate values.
Loic Dachary [Sun, 17 May 2015 15:53:55 +0000 (17:53 +0200)]
erasure-code: ErasureCode default value is a string
The to_int, to_bool prototypes are modified and the default values are
changed to string instead of int. If a default value is set, the profile
is modified to contain the default value.
The to_string helper is added so it can be used to set the default value
of a string, in a way that is consistent with to_int and to_bool.