Commit Graph

18030 Commits

Author SHA1 Message Date
Sam Lang
082746d6d0 client: Fix assert when stale arrives before open
The client sends an open session request to the mds, which may not
get a chance to reply before the mds timer times out the session and
sends the client a stale message.  This fix avoids the assertion by
checking that a pending open session request is in progress.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
2012-10-05 16:12:32 -05:00
Tommi Virtanen
0405a443b5 ceph-disk-activate, upstart: Use "initctl emit" to start OSDs.
This avoids an error if the daemon was running already, and is
already being done with the other services.

Signed-off-by: Tommi Virtanen <tv@inktank.com>
2012-10-05 11:10:22 -07:00
Tommi Virtanen
1f3a50a521 ceph-create-keys: Refactor to share wait_for_quorum call.
Signed-off-by: Tommi Virtanen <tv@inktank.com>
2012-10-05 11:09:06 -07:00
Tommi Virtanen
4302f12a60 ceph-create-keys: Create a bootstrap-osd key too.
Signed-off-by: Tommi Virtanen <tv@inktank.com>
2012-10-05 11:09:06 -07:00
Sam Lang
a53a4a21a0 client: Don't keep sending SESSION_REQUEST_OPEN
This fixes a bug where the client keeps resending session open requests
to the target mds because the waiting_for_session.count check was
incorrectly using the passed in mds number instead of the target.

Also output the mds the message is coming from for debugging.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
2012-10-05 10:54:54 -05:00
Dan Mick
2d6953a44c Revert "rbd: gracefully handle extra arguments"
Insufficient understanding of fragile algorithm.  This needs more
thought and I don't want the parsing broken as it is now.

This reverts commit 0d48879320.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
2012-10-04 21:14:18 -07:00
Josh Durgin
20496b8d2b OSD: separate class caps from normal read/write
This properly accounts for multi-op requests. Use MOSDOp->rmw_flags for
internal caps requirements, leaving MOSDOp->flags for client specified
options. Use accessors so the flags don't need to be known by the callers.

Also separate capability checks (need_*_cap) from the nature of the MOSDOp
(may_{read,write}). This preserves the semantics of may_{read,write},
which are used in several places outside of capability checks.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-10-04 18:36:07 -07:00
Dan Mick
0d48879320 rbd: gracefully handle extra arguments
Instead of looping across all args, with increments inside the loop,
which can run off the end of the vector, demand that the final
argument parsing have exactly the right number of args, or complain
about the extras and die.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
2012-10-04 18:08:28 -07:00
Sage Weil
aed3612f87 MOSDBoot: fix compatibility with ~argonaut
I revved this message and forgot to set the compat version correctly,
preventing post-change (e.g., bobtail) OSDs from talking to pre-change
(e.g., argonaut) monitors.  This was in b64641c.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-04 17:01:33 -07:00
Dan Mick
bed55369a9 rbd: Use TextTable for showmapped and lock list
Also update ocf/rbd.in to handle new output form (spaces)

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
2012-10-04 16:20:13 -07:00
Sage Weil
c109329244 librbd: simplify math
Bending over backwards hasn't made coverity happy.  We'll just ignore it
there.

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit c517fde269)
2012-10-04 15:45:50 -07:00
Dan Mick
61b2e4d6ac rbd: use TextTable to implement ls -l
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
2012-10-04 15:20:29 -07:00
Dan Mick
fb88683cd1 Add TextTable class for table output
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
2012-10-04 15:20:29 -07:00
Dan Mick
9889d819d7 librbd: fix error handling in get_parent_info
Return ENOENT if no parent.
Return error if pool reverse lookup fails.

Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
2012-10-04 15:20:29 -07:00
Tommi Virtanen
36f1698486 rbd.py: Fix docstring syntax of list_lockers().
Signed-off-by: Tommi Virtanen <tv@inktank.com>
2012-10-04 14:54:17 -07:00
Tommi Virtanen
2411ba696d rbd.py: Docstring syntax.
It's meth for referring to Python class methods:
http://sphinx.pocoo.org/domains.html#python-roles

The links to format() and features() are currently
dead because those methods don't have docstrings.
They'll start working once docstrings are added.

Signed-off-by: Tommi Virtanen <tv@inktank.com>
2012-10-04 14:54:17 -07:00
Sage Weil
ad97bbb0a1 Merge remote-tracking branch 'gh/next' 2012-10-04 10:08:46 -07:00
Joao Eduardo Luis
d5c3c47619 mon: Elector: clean ack set on election start
We should never consider old 'acks' from monitors on a new election. We
usually do it, but we didn't if an election expired, because this code
didn't foresee the possibility of monitors changing ranks in-between
elections -- which doesn't happen if we specify the monmap during the
monitor's mkfs, but may happen when relying on 'mon initial peers'.

Failing to do so triggered an assertion after fixing bug #3252.

Backport: argonaut

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-04 17:36:10 +01:00
Joao Eduardo Luis
35f5effa73 mon: Elector: bootstrap on new monmap from elector
Whenever we update the monmap we should bootstrap, in order to reset the
monitor's on-going activities and re-probe.

Not doing so contributed to bug #3252, during which we entered an infinite
election cycle. This may only happen though when we rely on 'mon initial
peers'. Specifying a monmap during the monitor's mkfs should not trigger
this bug.

Fixes: #3252
Backport: argonaut

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-04 17:36:03 +01:00
Joao Eduardo Luis
a6ba95fec0 mon: dump formatted crushmap on report
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
2012-10-04 17:11:35 +01:00
Sage Weil
36efcb5518 mon: do not tick() until all paxos instances recover
We cannot propose until they all recover.

Fixes: #3260
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
2012-10-03 16:24:18 -07:00
Sage Weil
db7c41934b Merge branch 'wip-mds' 2012-10-03 10:43:49 -07:00
Sam Lang
fec1912111 client: Fix #2215 with cache inval in thread
The client currently deadlocks with kernel buffer cache invalidation
enabled, due to the client lock calling the invalidate callback, which
in turn sends up calls back to the userspace process which try to lock
the same client lock.  The fix is to invoke the invalidate callback in
a separate thread, allowing _release, _flushed, etc. to complete,
unlocking the client lock so that the invalidate callback avoids deadlock
when the up call is made.

We construct a separate work queue (Finisher) that allows scheduling
the invalidate callbacks in a separate thread.  The thread only starts
when the invalidate callback is set.  If no callback is set, the cache
capability reference is decremented inline as before.

Some callers of invalidate_inode_cache (flush and update_inode_file_bits)
don't expect the cache capability to be decremented.  Pass a keep_caps flag to
only decrement the capability ref in the _release case.

Also, we need to make sure the mds is aware that the client has dropped
the cache capability, so we add a call to check_caps in put_cap_ref for the
CEPH_CAP_FILE_CACHE capability.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
2012-10-03 11:38:11 -05:00
Sam Lang
847728e5a1 client: Remove unnecessary checkafter parameter
The logic in put_cap_ref doesn't do anything but inode->put_cap_ref
if cap is set to CEPH_CAP_FILE_CACHE, so checkafter isn't needed.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
2012-10-03 11:38:11 -05:00
Sam Lang
68fbbea234 ceph-fuse: Test for fuse cache issue (#2215)
Signed-off-by: Sam Lang <sam.lang@inktank.com>
2012-10-03 11:38:11 -05:00
Sage Weil
2de5670583 mds: make migrate_stray() specify full path
The handle_client_rename() check expects a full path rooted in the MDSDIR.
Do so in migrate_stray().

Also, use the committed (not projected) dn linkage; this was a carry-over
from the original switch to this API forever ago, but the current callers
don't need to migrate an uncommitted stray.  This also aligns us with
reintegrate_stray().

Reported-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-03 09:12:40 -07:00
Sage Weil
9cabbb26c1 mds: fix stray reintegration check in handle_client_rename
The stray reintegration generates a source path that will be rooted in a
(possibly remote) MDS's MDSDIR; adjust this check accordingly.  This is a
holdover from way back when the straydir was the base of the tree instead
of mdsdir.

Reported-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-03 08:23:08 -07:00
Dan Mick
01bfe55962 Merge branch 'wip-msgr' into next 2012-10-02 16:06:59 -07:00
Dan Mick
67a201d64b Avoid sign-extension of non-magic Message* values
Cast to (unsigned long) when checking for magic values, so
real ptrs don't get sign-extended.  Avoids triggering
assert(inq == &local_queue) failure.

Fixes: #3251
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Sage Weil <sage.weil@inktank.com>
2012-10-02 16:04:35 -07:00
Josh Durgin
2e366ea8aa OSD: deprecate CLS_METHOD_PUBLIC flag
Remove all existing usage, but leave the definition so third-party
class plugins don't break.

The public flag let *any* user execute a class method, as long
as they had read and/or write access as the method required. This is
better managed by the new osd caps infrastructure, and it was
entirely undocumented and unused, so it should be safe to remove.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-10-02 15:43:37 -07:00
Josh Durgin
13ba5ec528 objclass: require each class method to have a flag set
The osd depends on this to set the client op flags for class call ops.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-10-02 15:43:37 -07:00
Josh Durgin
135c85a46e OSDCap: add separate caps for class read and class write
These are useful for rbd layering, since reading an rbd image
requires read-only class methods.

Fixes: #3167
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-10-02 15:43:37 -07:00
Josh Durgin
bf333d8e43 OSDCap: allow runs of spaces anywhere
I couldn't find a way to do this with skip parsers,
so these are explicitly included in the grammar.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-10-02 15:40:23 -07:00
Yan, Zheng
e8df6a74ca mds: Avoid creating unnecessary snaprealm
When moving directory between snaprealms, we can avoid creating snaprealm
if the directory doesn't has its own snaprealm and directory was created
after both realms' newest snapshot.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-10-02 11:26:20 -07:00
Yan, Zheng
5673523242 mds: Properly re-calculate mdsdir inode's auth bit
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-10-02 11:26:20 -07:00
Yan, Zheng
60b93a71d1 mds: Trim non auth subtree directory
Trim non auth subtree directory if all its dentries were trimmed
and it's not bound of auth subtree.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-10-02 11:26:19 -07:00
Yan, Zheng
d2861d9a02 mds: Properly update dirty dir fragstat during log replay
Dirty dir fragstat is managed by filelock instead of nestlock.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-10-02 11:24:49 -07:00
Yan, Zheng
f8110cb082 mds: Allow export subtrees in other MDS' stray directory
Stray migration is implemented by rename, it may create auth subtrees
in other MDS' stray directory.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-10-02 11:24:48 -07:00
Yan, Zheng
1cc28d5887 mds: Avoid save unnecessary parent snaprealm
We can avoid save parent snaprealm if current_parent_since is greater
than parent snaprealm's newest sequence.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-10-02 11:23:54 -07:00
Yan, Zheng
824e593bd6 mds: Set metablob.renamed_dirino in do_rename_rollback()
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-10-02 11:23:37 -07:00
Yan, Zheng
35dc221870 mds: Fix xlock imports
Xlock imports and capability imports are uncorrelated, we should call
xlock_import() even there is no capability import.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-10-02 11:22:47 -07:00
Yan, Zheng
bc1e52ff5f mds: Allow rename request for stray migration/reintegration
Allow rename request to modify system directory if it is for stray
migration/reintegration.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-10-02 11:22:35 -07:00
Yan, Zheng
c6c6de5d0d mds: Add finish callback to waiting_for_base_ino wait queue
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-10-02 11:22:25 -07:00
Yan, Zheng
7004829c35 mds: Consider stopping MDS when finding peer inode
To migrate strays, the receiving MDS need find stopping MDS' mdsdir

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-10-02 11:22:23 -07:00
Yan, Zheng
b8aeb76795 mds: Don't drop client request from MDS
MDS may send client request for stray migration/reintegration.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-10-02 11:22:21 -07:00
Sage Weil
e2f6ae03b8 filejournal: check lseek() return value on darwin
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-02 10:42:50 -07:00
Sage Weil
13b841c746 osdmap, mon: optional dump 'osd tree' in json
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-02 10:42:50 -07:00
Sam Lang
14de7a5336 client: Resolves coverity NULL dereference issue
Client::insert_trace() was handling readdir and lssnap replies
assuming that the directory inode was not null.  This commit
checks that the directory inode (returned as part of the trace)
is not null, and invokes insert_readdir_results() for the readdir
and lssnap replies.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2012-10-02 09:27:50 -07:00
Sage Weil
d250bb85f0 libcephfs: destroy cmount on ceph_shutdown()
Otherwise this chunk of the heap is leaked.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-01 21:08:27 -07:00
Sage Weil
965ab908fc filestore: check ioctl SYNC return code
CID 716860: Unchecked return value (CHECKED_RETURN)
At (22): Calling function "ioctl(int, unsigned long, ...)" without checking return value (as is done elsewhere 30 out of 31 times).

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-01 21:02:43 -07:00
Samuel Just
8237f6869f obj_bencher: fix leak in error path
CID 717076: Resource leak (RESOURCE_LEAK)At (26): Variable "newContents" going
out of scope leaks the storage it points to.

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-10-01 15:41:24 -07:00
Samuel Just
709ff1457b PG: assert auth is not end in _compare_scrubmaps
This should make coverity happy.

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-10-01 15:27:10 -07:00
Samuel Just
7ca754bec0 FileStore: copy paste error _do_copy_range
CID 728419: Copy-paste error (COPY_PASTE_ERROR)At (2): "srcoff" in "actual !=
(int64_t)srcoff" looks like a copy-paste error. Should it say "dstoff" instead?

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-10-01 15:23:00 -07:00
Josh Durgin
12bba4a5b2 OSDCap: parse spaces explicitly
This is necessary to avoid matching things like "allow r poolfoo".
It's also needed to distinguish "allow r class-read" from
"allow r class -read".

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-10-01 10:26:06 -07:00
Josh Durgin
b57b86a215 test: remove commented out test cases
These are copied from non-commented out ones a few lines above.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-10-01 10:24:47 -07:00
Tobias Florek
32a6394be0 logrotate: check for executables to avoid cron errors
Signed-off-by: Tobias Florek <tobias.florek@bytesandbutter.de>
2012-10-01 09:02:46 -07:00
Sage Weil
2bf3f8c588 filestore: check lseek64 return value
CID 716862: Other violation (CHECKED_RETURN)
At (3): Calling function "lseek64(to, dstoff, 0)" without checking return value. This library function may fail and return an error code.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-30 20:54:44 -07:00
Sage Weil
409fbb7cbc filestore: check ioctl WAIT_SYNC return value
CID 716860: Unchecked return value (CHECKED_RETURN)
At (27): Calling function "ioctl(int, unsigned long, ...)" without checking return value (as is done elsewhere 29 out of 31 times).

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-30 20:54:44 -07:00
Sage Weil
15ebc0ff1e filejournal: check lseek64 return value
CID 716858: Other violation (CHECKED_RETURN)
At (6): Calling function "lseek64(this->fd, pos, 0)" without checking return value. This library function may fail and return an error code.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-30 20:54:44 -07:00
Sage Weil
ef393b5074 mon: fix large pass by value
CID 717046: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter i of type entity_inst_t (size 152 bytes) by value.

CID 717047: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter i of type entity_inst_t (size 152 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-30 20:45:15 -07:00
Sage Weil
5defa9263a mon/PGMap: fix nearfull check
CID 716881: Copy-paste error (COPY_PASTE_ERROR)
At (2): "full_ratio" in "inc.full_ratio" looks like a copy-paste error. Should it say "nearfull_ratio" instead?

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-30 20:44:17 -07:00
Sage Weil
821f61d1a2 Merge branch 'next' 2012-09-30 20:24:34 -07:00
Sage Weil
72ca956632 test_libcephfs: fix test
Can't close an already-closed dir handle.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-30 20:24:23 -07:00
Sage Weil
1ad339f781 mon: fix recovered_peon assert
Recovered_peon() can get called multiple times for a given machine id.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-30 15:12:59 -07:00
Sage Weil
238b497a1c mon: debug recovered_{peon,leader}
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-30 15:12:56 -07:00
Sage Weil
b8cbe26c5f mon: fix recovered_peon assert
Recovered_peon() can get called multiple times for a given machine id.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-30 15:12:46 -07:00
Sage Weil
1708cf8d82 mon: debug recovered_{peon,leader}
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-30 14:26:52 -07:00
Sage Weil
6f7067f489 mon: avoid large pass by value in MForward
CID 717035: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter caps of type MonCaps (size 144 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:35:36 -07:00
Sage Weil
4878fdcc74 mds: fix MDSCacheObject pin printer * logic
CID 716895: Logically dead code (DEADCODE)
At (4): Execution cannot reach this statement "(out << "*") << c;".

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:34:26 -07:00
Sage Weil
a3e42d800d mdsmap: init fields in ctor
At (2): Non-static class member "session_timeout" is not initialized in this constructor nor in any functions that it calls.
At (4): Non-static class member "session_autoclose" is not initialized in this constructor nor in any functions that it calls.
At (6): Non-static class member "max_file_size" is not initialized in this constructor nor in any functions that it calls.
CID 717238: Uninitialized scalar field (UNINIT_CTOR)
At (8): Non-static class member "max_mds" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:32:08 -07:00
Sage Weil
1cebd989e7 mds: fix potential overflow
CID 717014: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "in->inode.layout.fl_object_size.operator unsigned int() * in->inode.layout.fl_stripe_count.operator unsigned int()" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic before being used in a context which expects an expression of type "uint64_t" (64 bits, unsigned). To avoid overflow, cast either operand to "uint64_t" before performing the multiplication.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:30:35 -07:00
Sage Weil
694a4f0f16 mds: init atid in context
CID 717236: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "atid" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:29:49 -07:00
Sage Weil
18668ba001 mds: init log layout in MDCcahe ctor
CID 717237: Uninitialized scalar field (UNINIT_CTOR)
At (8): Non-static class member field "default_file_layout.fl_stripe_unit" is not initialized in this constructor nor in any functions that it calls.
At (10): Non-static class member field "default_file_layout.fl_stripe_count" is not initialized in this constructor nor in any functions that it calls.
At (12): Non-static class member field "default_file_layout.fl_object_size" is not initialized in this constructor nor in any functions that it calls.
At (14): Non-static class member field "default_file_layout.fl_cas_hash" is not initialized in this constructor nor in any functions that it calls.
At (16): Non-static class member field "default_file_layout.fl_object_stripe_unit" is not initialized in this constructor nor in any functions that it calls.
At (18): Non-static class member field "default_file_layout.fl_unused" is not initialized in this constructor nor in any functions that it calls.
At (20): Non-static class member field "default_file_layout.fl_pg_pool" is not initialized in this constructor nor in any functions that it calls.
At (21): Non-static class member field "default_log_layout.fl_stripe_unit" is not initialized in this constructor nor in any functions that it calls.
At (22): Non-static class member field "default_log_layout.fl_stripe_count" is not initialized in this constructor nor in any functions that it calls.
At (23): Non-static class member field "default_log_layout.fl_object_size" is not initialized in this constructor nor in any functions that it calls.
At (24): Non-static class member field "default_log_layout.fl_cas_hash" is not initialized in this constructor nor in any functions that it calls.
At (25): Non-static class member field "default_log_layout.fl_object_stripe_unit" is not initialized in this constructor nor in any functions that it calls.
At (26): Non-static class member field "default_log_layout.fl_unused" is not initialized in this constructor nor in any functions that it calls.
At (27): Non-static class member field "default_log_layout.fl_pg_pool" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:29:00 -07:00
Sage Weil
7594e9ce0f mds: simplify get_dirfrag()
Avoid useless have_inode() call.

CID 716996: Dereference null return value (NULL_RETURNS)
At (13): Dereferencing a pointer that might be null "this->get_inode(df.ino, snapid_t(18446744073709551614UL))" when calling "CInode::get_dirfrag(frag_t)". [hide details]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:27:33 -07:00
Sage Weil
bef66e010b mds: fix mlogger shutdown
CID 716880: Copy-paste error (COPY_PASTE_ERROR)
At (2): "logger" in "this->logger" looks like a copy-paste error. Should it say "mlogger" instead?

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:26:05 -07:00
Sage Weil
4aef86f5c7 mds: fix leak from get_current_dir_name
CID 717086: Resource leak (RESOURCE_LEAK)
At (18): Ignoring storage allocated by "get_current_dir_name()" leaks it.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:25:25 -07:00
Sage Weil
c517fde269 librbd: simplify math
Bending over backwards hasn't made coveirty happy.  We'll just ignore it
there.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:22:19 -07:00
Sage Weil
7779901e5f mds: add assert to lock path
This makes coverity happy:

CID 716916: Explicit null dereferenced (FORWARD_NULL)
At (28): Passing null pointer "in" to function "MDSCacheObject::state_test(unsigned int) const", which dereferences it. [hide details]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:17:21 -07:00
Sage Weil
816bb7e965 mds: fix uninit Dumper fields in ctor
CID 717234: Uninitialized pointer field (UNINIT_CTOR)
At (8): Non-static class member "rank" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:16:16 -07:00
Sage Weil
e9f350f144 mds: fix fd leak in dumper
CID 717084: Resource leak (RESOURCE_LEAK)
At (6): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:14:58 -07:00
Sage Weil
e604de1d61 mds: fix uninit Capability::last_issue
CID 717233: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "last_issue" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:12:53 -07:00
Sage Weil
82aecedf30 mds: fix uninit field in CInode
CID 717231: Uninitialized scalar field (UNINIT_CTOR)
At (3): Non-static class member "auth_pin_freeze_allowance" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:11:41 -07:00
Sage Weil
1acd109296 mds: fix typo in rsubdirs warning
CID 716879: Copy-paste error (COPY_PASTE_ERROR)
At (2): "rfiles" in "pi->rstat.rfiles" looks like a copy-paste error. Should it say "rsubdirs" instead?

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:09:43 -07:00
Sage Weil
310e486817 mds: init CDir fields
CID 717230: Uninitialized scalar field (UNINIT_CTOR)
At (8): Non-static class member "num_dentries_auth_subtree_nested" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:08:30 -07:00
Sage Weil
5e51f5506a mds: avoid useless have_inode() call
CID 716989: Dereference null return value (NULL_RETURNS)
At (83): Dereferencing a pointer that might be null "in" when calling "operator <<(std::ostream &, CInode &)". [hide details]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:06:38 -07:00
Sage Weil
6047325763 osd: pass by value
CID 717054: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter recovery_info of type ObjectRecoveryInfo (size 640 bytes) by value.

and more

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 00:59:54 -07:00
Sage Weil
af1153147a osd: fix coverity NULL warning
Session is alwasy set on requests.

CID 717008: Dereference null return value (NULL_RETURNS)
At (34): Dereferencing a pointer that might be null "session" when calling "OSD::Session::del_notif(void *)". [hide details]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 00:57:40 -07:00
Sage Weil
ada0db3660 osd: logger is never NULL
We set this up in init(), so we don't need to make these dereferences
conditional.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 00:53:28 -07:00
Sage Weil
020856bba8 osd/PG: remove redundant NamedState
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 00:51:08 -07:00
Sage Weil
0769a1d35e osd: init all vars in PG::NamedState
CID 717341: Uninitialized pointer field (UNINIT_CTOR)
At (2): Non-static class member "state_name" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 00:50:57 -07:00
Sage Weil
09f602d2fb ceph tool: fix cli test
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 18:34:26 -07:00
Sage Weil
7827c566ad mon: fix uninit var warning in session startup
This is a false positive; just init the var.

CID 717198: Uninitialized scalar variable (UNINIT)
At (18): Using uninitialized value "auid" when calling "MonCaps::set_auid(uint64_t)". [hide details]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 18:16:49 -07:00
Sage Weil
f4c34c06e9 filstore: fix leak of fd in write error paths
CID 717095: Resource leak (RESOURCE_LEAK)
At (13): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 18:14:24 -07:00
Sage Weil
e0820d2120 filestore: fix fd leak
CID 717088: Resource leak (RESOURCE_LEAK)
At (11): Handle variable "tmpfd" going out of scope leaks the handle.

Also unlink the file.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 18:12:34 -07:00
Sage Weil
dfac9b34c2 mds: dentry always has dir
CID 716912: Dereference after null check (FORWARD_NULL)
At (3): Passing null pointer "this->dir" to function "CDir::ino() const", which dereferences it. [hide details]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 17:56:34 -07:00
Sage Weil
d5f8e42b14 librbd: init value in CopyProgressCtx ctor
CID 717227: Uninitialized pointer field (UNINIT_CTOR)
At (4): Non-static class member "src_size" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 17:54:34 -07:00
Sage Weil
e43f4ff872 librbd: fix overflow assert check
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 17:53:29 -07:00
Sage Weil
f1f7ac7879 ceph tool: document 'ceph osd map ...' command
Closes: #3223
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 17:37:53 -07:00
Sage Weil
da43de34e6 Merge remote-tracking branch 'gh/wip-coverity-common'
Reviewed-by: Samuel Just <sam.just@inktank.com>
2012-09-28 17:31:41 -07:00
Josh Durgin
2e1ea3f057 OSDCap: parse 'pool=<poolname>' in addition to 'pool <poolname>'
This was used in releases before 0.49, and was the documented way
to use it in several places, so support it again for backwards
compatibility.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-28 16:33:58 -07:00
Samuel Just
1d675cc064 Merge branch 'next' 2012-09-28 16:31:27 -07:00
Samuel Just
c925ce8663 FileStore: use fresh vector for calls for listing collection
In collection_list_range, use an empty vector to pass into
collection_list_partial.  collection_list_partial stops
listing when the output vector exceeds the specified max.
If this happens before we hit the end of the range,
collection_list_range will spin forever.

Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Mike Ryan <mike.ryan@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
2012-09-28 16:29:28 -07:00
Josh Durgin
67ab9659fb Makefile.am: recompile small file instead of libosd for unit test
Linking with libosd requires a lot more recompilation
when testing changes to OSDCap.cc.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-28 16:09:59 -07:00
Josh Durgin
524a438d05 test: add more OSDCap unit tests
Check that allow_all() returns false when 'allow *' is not specified.
This would have caught #3228.
Add tests for the output operators as well.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-28 16:09:59 -07:00
Josh Durgin
142d9021dc OSDCaps: fix allow_all()
OSD_CAP_ANY is not a mask. Treating it as one made any allowance
equivalent to 'allow *'.

Fixes: #3228
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-28 16:09:59 -07:00
Josh Durgin
30903662f3 OSDCap: fix output operators for caps
OSD_CAP_ANY is not a flag, but a value (0xff) that will always
be true when treated as a mask with a non-zero rwxa_t.

Don't duplicate the rwxa_t output operator in the OSDCapSpec output
operator, just use it.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-28 16:09:58 -07:00
Josh Durgin
47a2f41be0 OSDCap: fix typo in comment
The grammar uses auid, not uid.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-28 16:09:58 -07:00
Josh Durgin
42a63f34cc OSDCap: remove grants added during failed parsing
Parsing has side effects that must be undone if it fails.  A
capability string like 'allow rwx pool=bar' will add the grant for
'allow rwx' and then fail on the 'pool=bar'. Thus, the client will
effectively have 'rwx' permissions on all pools.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-28 16:09:58 -07:00
Sage Weil
e61b965a5f osdmap: restore stream format
CID 727986: Not restoring ostream format (STREAM_FORMAT_STATE)
At (20): Changing format state of stream "out" for category precision without later restoring it.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:07 -07:00
Sage Weil
70e35ba9b1 cephtool: fix resource leak
CID 717124: Resource leak (RESOURCE_LEAK)
At (17): Variable "m" going out of scope leaks the storage it points to.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
779e0f0fb0 cls_refcount: fix uninit vals in ctor
CID 727989: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "implicit_ref" is not initialized in this constructor nor in any functions that it calls.

+ a few others

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
67caceec18 rados: fix error paths in do_put()
CID 716986: Improper use of negative value (NEGATIVE_RETURNS)
At (9): "count" is passed to a parameter that cannot be negative. [hide details]

+ other stuff

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
903f60aee0 osdmaptool: fix pg_t::parse() return value check
CID 716876: Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
At (1): pgid.parse(test_map_pg.c_str()) < 0 is always false regardless of the values of its operands. This occurs as the logical operand of if.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
d5b4f9af42 osdmaptool: check return values
CID 716864: Unchecked return value (CHECKED_RETURN)
At (155): Calling function "ceph::buffer::list::read_file(char const *, std::string *)" without checking return value (as is done elsewhere 14 out of 16 times).

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
0b3c5dc58c objecter: fix dereference after null check
CID 716933: Dereference after null check (FORWARD_NULL)
At (4): Passing null pointer "extra_ops->ops" to function "std::vector<OSDOp, std::allocator<OSDOp> >::operator [](std::vector<OSDOp, std::allocator<OSDOp> >::size_type)", which dereferences it. [hide details]

All callers pass 1, but this was also hard-coded into the helper logic.
Fix code (and doxygen desc) to allow other values.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
b1d85130d1 objectcacher: fix uninit var in ctor
CID 717351: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "tid" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
62273b5cbf objectcacher: fix uninit it ctor
CID 717350: Uninitialized scalar field (UNINIT_CTOR)
At (4): Non-static class member field "ex.length" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
e5103b44bc objectcacher: avoid confusing coverity
CID 716932: Explicit null dereferenced (FORWARD_NULL)
At (21): Passing null pointer "final" to function "ObjectCacher::BufferHead::end() const", which dereferences it. [hide details]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
a1f9dbc690 journaler: uninit var in ctor
CID 717349: Uninitialized scalar field (UNINIT_CTOR)
At (14): Non-static class member field "layout.fl_pg_pool" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
7b90139f4e journaler: uninit var in ctor
CID 717348: Uninitialized scalar field (UNINIT_CTOR)
At (14): Non-static class member field "layout.fl_pg_pool" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
50460f90f5 filer: fix overflow
CID 717017: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "layout->fl_stripe_count.operator unsigned int() * layout->fl_object_size.operator unsigned int()" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic before being used in a context which expects an expression of type "uint64_t" (64 bits, unsigned). To avoid overflow, cast either operand to "uint64_t" before performing the multiplication.

+ more

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
d2cbe1fb6d MOSDFailure: avoid big pass by value
CID 727975: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter f of type entity_inst_t (size 152 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
cb0d9690a7 MMonJoin: avoid large pass by value
CID 717036: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter a of type entity_addr_t (size 136 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
e92b92b2b6 MRoute: avoid pass by value
CID 717038: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter i of type entity_inst_t (size 152 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
02e48394cc messages: uninit values
CID 717259: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "global_id" is not initialized in this constructor nor in any functions that it calls.

CID 728086: Uninitialized scalar field (UNINIT_CTOR)
At (4): Non-static class member "type" is not initialized in this constructor nor in any functions that it calls.

CID 717260: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "from" is not initialized in this constructor nor in any functions that it calls.

CID 717261: Uninitialized scalar field (UNINIT_CTOR)
At (51): Non-static class member field "head.time_warp_seq" is not initialized in this constructor nor in any functions that it calls.

+ more

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
b5fb298d38 msg/Messenger: avoid large pass by value
CID 717049: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter bind_addr of type entity_addr_t (size 136 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
797d3ccb7a msg/Accepter: check getsockbyname() return value
CID 717442: Other violation (CHECKED_RETURN)
At (10): Calling function "getsockname(this->listen_sd, (sockaddr *)listen_addr.ss_addr(), &llen)" without checking return value. This library function may fail and return an error code.
At (11): No check of the return value of "getsockname(this->listen_sd, (sockaddr *)listen_addr.ss_addr(), &llen)".

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
ae1c38f195 LogEntry: fix uninit in ctor
At (2): Non-static class member "m_thread" is not initialized in this constructor nor in any functions that it calls.
At (4): Non-static class member "m_prio" is not initialized in this constructor nor in any functions that it calls.
At (6): Non-static class member "m_subsys" is not initialized in this constructor nor in any functions that it calls.
CID 717229: Uninitialized scalar field (UNINIT_CTOR)
At (8): Non-static class member "m_static_buf" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
2381f12a04 utime: restore ostream state
CID 717130: Not restoring ostream format (STREAM_FORMAT_STATE)
At (4): Changing format state of stream "out" for category fill without later restoring it.

CID 717131: Not restoring ostream format (STREAM_FORMAT_STATE)
At (4): Changing format state of stream "out" for category fill without later restoring it.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
95dca9895b stringify: use const ref
CID 727974: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter a of type entity_addr_t (size 136 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
884daeb108 addr_parsing: fix memory leak
CID 717082: Resource leak (RESOURCE_LEAK)
At (4): Variable "buf" going out of scope leaks the storage it points to.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
98da9f9b8c pidfile: fix fd leak from pidfile_remove()
CID 717081: Resource leak (RESOURCE_LEAK)
At (10): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
687d6d58f1 crushtester: fix uninit var
CID 717197: Uninitialized scalar variable (UNINIT)
At (35): Using uninitialized value "only_osd_affected".

Fix some whitespace too.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
b7cf6030ae crushtester: avoid divide by zero
CID 716906: Division or modulo by zero (DIVIDE_BY_ZERO)
At (214): In expression "(float)weight[i] / (float)total_weight", division by expression "total_weight" which may be zero has undefined behavior.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
ffe0e09b95 crushtester: avoid divide by zero
CID 716904: Division or modulo by zero (DIVIDE_BY_ZERO)
At (4): In expression "(float)weight[i] / (float)total_weight", division by expression "total_weight" which may be zero has undefined behavior.

At (8): On this path, function call "this->crush->get_max_devices()" has return value of 0
CID 716905: Division or modulo by zero (DIVIDE_BY_ZERO)
At (9): In expression "lrand48() % this->crush->get_max_devices()" modulo by expression "this->crush->get_max_devices()" which may be zero has undefined behavior.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
7490032008 adminsocket: fix sock-fd leak in failure path
CID 728088: Resource leak (RESOURCE_LEAK)
At (9): Handle variable "sock_fd" going out of scope leaks the handle.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
af5f143736 PrebufferedStream: avoid dereferencing end()
This appeared to work, but probably isn't a good idea.

CID 716940: Using invalid iterator (INVALIDATE_ITERATOR)
At (4): Dereferencing iterator "this->m_overflow.end()" though it is already past the end of its container.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
cf6639a049 perfcounters: remove unused members
Avoids coverity warning

CID 717214: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "m_shutdown_fd" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
5846e27b73 obj_bencher: protect with lock
This makes coverity happy.

CID 716963: Data race condition (MISSING_LOCK)
At (1): Accessing "this->data.finished" ("bench_data.finished") requires the "Mutex._m" lock.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
f577c8291f obj_bencher: possible divice by zero
CID 716903: Division or modulo by zero (DIVIDE_BY_ZERO) [select defect]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
ce0633980e lockep: fix leak in failure/assert path
This is useless excepto make coverity happy.

CID 717075: Resource leak (RESOURCE_LEAK)
At (12): Variable "bt" going out of scope leaks the storage it points to.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
4bd27998d9 ipaddr: fix buffer overrun on ipv6 prefix of 128
CID 717020: Out-of-bounds read (OVERRUN)
At (3): Overrunning array "addr->__in6_u.__u6_addr8" of 16 bytes at byte offset 16 using index "prefix_len / 8U" (which evaluates to 16).

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
6f897659ad config: don't leak buf on dump config
CID 717074: Resource leak (RESOURCE_LEAK)
At (26): Variable "buf" going out of scope leaks the storage it points to.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
66f7c41ed5 buffer: init data val in ctor
CID 717213: Uninitialized pointer field (UNINIT_CTOR)
At (2): Non-static class member "data" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
05dc45f68f buffer: restore stream state after hexdump()
CID 717129: Not restoring ostream format (STREAM_FORMAT_STATE)
At (51): Changing format state of stream "out" for category fill without later restoring it.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
9bd673f178 adminsocket: init vars in ctor
At (2): Non-static class member "m_version_hook" is not initialized in this constructor nor in any functions that it calls.
CID 717212: Uninitialized pointer field (UNINIT_CTOR)
At (4): Non-static class member "m_help_hook" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
dfb9488a42 adminsocket: change failure test
This makes coverity happier:

CID 716941: Using invalid iterator (INVALIDATE_ITERATOR)
At (35): Dereferencing iterator "p" though it is already past the end of its container.

only because it doesn't understand all the side-effects of the failure
branch above.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
3ec32c94ab adminsocket: check return value
CID 716847: Other violation (CHECKED_RETURN)
At (5): Calling function "fcntl(sock_fd, 2, 1)" without checking return value. This library function may fail and return an error code.
At (6): No check of the return value of "fcntl(sock_fd, 2, 1)".

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:03 -07:00
Sage Weil
73d854975e workqueue: reset heartbeat timeout under lock
This makes coverity happier:

CID 727967: Value not atomically updated (ATOMICITY)
At (44): Using an unreliable value of "hb" inside the second locked section. If the data that "hb" depends on was changed by another thread, this use might be incorrect.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:03 -07:00
Sage Weil
bdadc4eca6 MemoryModel: init in ctor
CID 717211: Uninitialized scalar field (UNINIT_CTOR)
At (18): Non-static class member field "last.mmap" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:03 -07:00