mds: init inode_t::dir_layout

At (2): Non-static class member field "dir_layout.dl_dir_hash" is not initialized in this constructor nor in any functions that it calls.
At (4): Non-static class member field "dir_layout.dl_unused1" is not initialized in this constructor nor in any functions that it calls.
At (6): Non-static class member field "dir_layout.dl_unused2" is not initialized in this constructor nor in any functions that it calls.
CID 717258 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)

Signed-off-by: Sage Weil <sage@inktank.com>
mds: init in cap_reconnect_t ctor

At (2): Non-static class member field "capinfo.cap_id" is not initialized in this constructor nor in any functions that it calls.
At (4): Non-static class member field "capinfo.wanted" is not initialized in this constructor nor in any functions that it calls.
At (6): Non-static class member field "capinfo.issued" is not initialized in this constructor nor in any functions that it calls.
At (8): Non-static class member field "capinfo.snaprealm" is not initialized in this constructor nor in any functions that it calls.
At (10): Non-static class member field "capinfo.pathbase" is not initialized in this constructor nor in any functions that it calls.
CID 717257 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
At (12): Non-static class member field "capinfo.flock_len" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: init cap_reconnect_t::flock_len

CID 717256 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member field "capinfo.flock_len" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: fix possible inode_t::get_layout_size_increment() overflow

CID 717015 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
Potentially overflowing expression "this->layout.fl_object_size.operator unsigned int() * this->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>
mds: fix coverity warnings on NULL deref

Add asserts...

At (5): Function "MDCache::get_dirfrag(dirfrag_t)" returns null (checked 33 out of 39 times). [show details]
At (6): Assigning: "dir" = null return value from "MDCache::get_dirfrag(dirfrag_t)".
CID 717007 (#1 of 1): Dereference null return value (NULL_RETURNS)
At (7): Dereferencing a pointer that might be null "dir" when calling "MDCache::adjust_bounded_subtree_auth(CDir *, std::vector<dirfrag_t, std::allocator<dirfrag_t> > &, std::pair<int, int>)". [show details]

CID 717006 (#1 of 1): Dereference null return value (NULL_RETURNS)
At (5): Dereferencing a pointer that might be null "dir" when calling "MDCache::adjust_bounded_subtree_auth(CDir *, std::vector<dirfrag_t, std::allocator<dirfrag_t> > &, std::pair<int, int>)". [show details]

CID 717005 (#2 of 2): Dereference null return value (NULL_RETURNS)
At (22): Dereferencing a pointer that might be null "dir" when calling "MDCache::adjust_bounded_subtree_auth(CDir *, std::vector<dirfrag_t, std::allocator<dirfrag_t> > &, int)". [show details]

Signed-off-by: Sage Weil <sage@inktank.com>
mds: annotate switch case fall-thru

CID 716960 (#1 of 1): Missing break in switch (MISSING_BREAK)
This case (value 1) is not terminated by a 'break' statement.

Signed-off-by: Sage Weil <sage@inktank.com>
mds: use const ref instead of large pass-by-value

CID 717033 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE)
Passing parameter inst of type entity_inst_t (size 152 bytes) by value.

CID 717034 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE)
Passing parameter inst of type entity_inst_t (size 152 bytes) by value.

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

Signed-off-by: Sage Weil <sage@inktank.com>
test/libcephfs: Fix telldir/seekdir test

Signed-off-by: Sam Lang <sam.lang@inktank.com>
monmap: pass by ref

CID 717039 (#1 of 1): Big parameter passed by value (PASS_BY_VALUE)
Passing parameter my_addr of type entity_addr_t (size 136 bytes) by value.

CID 717040: Big parameter passed by value (PASS_BY_VALUE)
Passing parameter a of type entity_addr_t (size 136 bytes) by value.

CID 717041: Big parameter passed by value (PASS_BY_VALUE)
Passing parameter a of type entity_addr_t (size 136 bytes) by value.

CID 717043: Big parameter passed by value (PASS_BY_VALUE)
Passing parameter a of type entity_addr_t (size 136 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: pass by ref

CID 717044: Big parameter passed by value (PASS_BY_VALUE)
Passing parameter to of type entity_inst_t (size 152 bytes) by value.

CID 717045: Big parameter passed by value (PASS_BY_VALUE)
Passing parameter a of type entity_addr_t (size 136 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: init vars in AioRequest ctor

At (2): Non-static class member "m_object_no" is not initialized in this constructor nor in any functions that it calls.
At (4): Non-static class member "m_object_off" is not initialized in this constructor nor in any functions that it calls.
CID 717222 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
At (6): Non-static class member "m_object_len" is not initialized in this constructor nor in any functions that it calls.

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

Signed-off-by: Sage Weil <sage@inktank.com>
librbd: init layout in ImageCtx ctor

At (6): Non-static class member field "layout.fl_stripe_unit" is not initialized in this constructor nor in any functions that it calls.
At (8): Non-static class member field "layout.fl_stripe_count" is not initialized in this constructor nor in any functions that it calls.
At (10): Non-static class member field "layout.fl_object_size" is not initialized in this constructor nor in any functions that it calls.
At (12): Non-static class member field "layout.fl_cas_hash" is not initialized in this constructor nor in any functions that it calls.
At (14): Non-static class member field "layout.fl_object_stripe_unit" is not initialized in this constructor nor in any functions that it calls.
At (16): Non-static class member field "layout.fl_unused" is not initialized in this constructor nor in any functions that it calls.
CID 717224 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
At (18): 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>
mds: avoid copy in SessionMap::get_or_add_session()

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

Signed-off-by: Sage Weil <sage@inktank.com>
Merge remote-tracking branch 'gh/wip-mds-coverity'
objecter: move map checks to helper

This makes coverity happier because we check_op_pool_dne() may free
the Op (or Lingerop) structure(s), but the callers in the submit_*
paths dereference after calling.  This is actually safe because they
never free new ops, but is confusing.  Explicitly push this into a
separate helper.

CID 739607 (#1-2 of 2): Read from pointer after free (USE_AFTER_FREE)
At (9): Dereferencing freed pointer "o".

CID 739606 (#1 of 1): Read from pointer after free (USE_AFTER_FREE)
At (28): Dereferencing freed pointer "op".

Signed-off-by: Sage Weil <sage@inktank.com>
vstart.sh: cephx on by default, -X to disable

Signed-off-by: Joe Buck <jbbuck@gmail.com>
doc: Changed rack, row text to row, rack. Fixed some syntax. Added note.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
run-cli-tests: Include rationale for cram patch and pointer to issue.

Signed-off-by: Tommi Virtanen <tv@inktank.com>
osd: populate obc watchers even when degraded

Bug #3142 appears to be caused by the following sequence:

 - object X missing on primary and replica
 - [assert-ver,watch], notify, unwatch requests come in, get deferred
 - object is recovered on primary, !missing, create_object_context
   - populate_obc_watchers() does nothing, since still degraded
 - notify happens now (odd but ok?)
 - replica recovered, !degraded
 - watch skips bc of bad assert
 - unwatch trips up on an assert because populate_obc_watchers never
   ran

Fix this by populating the obc watcher when !missing, not when
!degraded.  This conditional dates back to Sam's original watch/notify
cleanup in October 2011.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>
osd: drop conditional check in populate_obc_watchers

Turn these into asserts.  The only two callers are create_object_context()
and get_object_context(), and they only get called when the object is no
longer missing.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Samuel Just <sam.just@inktank.com>