]> git.apps.os.sepia.ceph.com Git - ceph.git/log
ceph.git
13 years agomds: Don't drop client request from MDS
Yan, Zheng [Tue, 2 Oct 2012 08:55:41 +0000 (16:55 +0800)]
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>
13 years agofilejournal: check lseek() return value on darwin
Sage Weil [Tue, 2 Oct 2012 16:45:00 +0000 (09:45 -0700)]
filejournal: check lseek() return value on darwin

Signed-off-by: Sage Weil <sage@inktank.com>
13 years agoosdmap, mon: optional dump 'osd tree' in json
Sage Weil [Tue, 2 Oct 2012 16:43:13 +0000 (09:43 -0700)]
osdmap, mon: optional dump 'osd tree' in json

Signed-off-by: Sage Weil <sage@inktank.com>
13 years agoclient: Resolves coverity NULL dereference issue
Sam Lang [Tue, 2 Oct 2012 15:43:05 +0000 (10:43 -0500)]
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>
13 years agolibcephfs: destroy cmount on ceph_shutdown()
Sage Weil [Tue, 2 Oct 2012 04:08:27 +0000 (21:08 -0700)]
libcephfs: destroy cmount on ceph_shutdown()

Otherwise this chunk of the heap is leaked.

Signed-off-by: Sage Weil <sage@inktank.com>
13 years agofilestore: check ioctl SYNC return code
Sage Weil [Tue, 2 Oct 2012 04:02:43 +0000 (21:02 -0700)]
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>
13 years agoobj_bencher: fix leak in error path
Samuel Just [Mon, 1 Oct 2012 22:34:04 +0000 (15:34 -0700)]
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>
13 years agoPG: assert auth is not end in _compare_scrubmaps
Samuel Just [Mon, 1 Oct 2012 22:27:10 +0000 (15:27 -0700)]
PG: assert auth is not end in _compare_scrubmaps

This should make coverity happy.

Signed-off-by: Samuel Just <sam.just@inktank.com>
13 years agoFileStore: copy paste error _do_copy_range
Samuel Just [Mon, 1 Oct 2012 22:23:00 +0000 (15:23 -0700)]
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>
13 years agodoc: Removed languages from librados in tech-specific stack diagrams.
John Wilkins [Mon, 1 Oct 2012 21:53:57 +0000 (14:53 -0700)]
doc: Removed languages from librados in tech-specific stack diagrams.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
13 years agodoc: Added stack diagram for rgw. Noted NO MDS. Corrected namespace comment.
John Wilkins [Mon, 1 Oct 2012 21:09:21 +0000 (14:09 -0700)]
doc: Added stack diagram for rgw. Noted NO MDS. Corrected namespace comment.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
13 years agodoc: Removed a setting we can ignore for now.
John Wilkins [Mon, 1 Oct 2012 21:08:34 +0000 (14:08 -0700)]
doc: Removed a setting we can ignore for now.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
13 years agodoc: Minor updates to filesystem settings.
John Wilkins [Mon, 1 Oct 2012 20:51:48 +0000 (13:51 -0700)]
doc: Minor updates to filesystem settings.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
13 years agodoc: Added journal settings to the config TOC.
John Wilkins [Mon, 1 Oct 2012 20:50:55 +0000 (13:50 -0700)]
doc: Added journal settings to the config TOC.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
13 years agodoc: Completed a journal configuration reference. Journaler is separate.
John Wilkins [Mon, 1 Oct 2012 20:50:31 +0000 (13:50 -0700)]
doc: Completed a journal configuration reference. Journaler is separate.

Signed-off-by: John Wilkins <john.wilkins@inktank.com>
13 years agologrotate: check for executables to avoid cron errors
Tobias Florek [Mon, 1 Oct 2012 16:02:06 +0000 (09:02 -0700)]
logrotate: check for executables to avoid cron errors

Signed-off-by: Tobias Florek <tobias.florek@bytesandbutter.de>
13 years agofilestore: check lseek64 return value
Sage Weil [Mon, 1 Oct 2012 03:50:16 +0000 (20:50 -0700)]
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>
13 years agofilestore: check ioctl WAIT_SYNC return value
Sage Weil [Mon, 1 Oct 2012 03:48:18 +0000 (20:48 -0700)]
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>
13 years agofilejournal: check lseek64 return value
Sage Weil [Mon, 1 Oct 2012 03:46:37 +0000 (20:46 -0700)]
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>
13 years agomon: fix large pass by value
Sage Weil [Mon, 1 Oct 2012 03:45:15 +0000 (20:45 -0700)]
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>
13 years agomon/PGMap: fix nearfull check
Sage Weil [Mon, 1 Oct 2012 03:44:17 +0000 (20:44 -0700)]
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>
13 years agoMerge branch 'next'
Sage Weil [Mon, 1 Oct 2012 03:24:34 +0000 (20:24 -0700)]
Merge branch 'next'

13 years agotest_libcephfs: fix test
Sage Weil [Mon, 1 Oct 2012 03:24:23 +0000 (20:24 -0700)]
test_libcephfs: fix test

Can't close an already-closed dir handle.

Signed-off-by: Sage Weil <sage@inktank.com>
13 years agolibcephfs: fix test workunit
Sage Weil [Mon, 1 Oct 2012 03:54:25 +0000 (20:54 -0700)]
libcephfs: fix test workunit

Signed-off-by: Sage Weil <sage@inktank.com>
13 years agoMerge branch 'next'
Sage Weil [Sun, 30 Sep 2012 22:17:33 +0000 (15:17 -0700)]
Merge branch 'next'

13 years agomon: fix recovered_peon assert
Sage Weil [Sun, 30 Sep 2012 22:12:46 +0000 (15:12 -0700)]
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>
13 years agomon: debug recovered_{peon,leader}
Sage Weil [Sun, 30 Sep 2012 21:26:52 +0000 (14:26 -0700)]
mon: debug recovered_{peon,leader}

Signed-off-by: Sage Weil <sage@inktank.com>
13 years agomon: fix recovered_peon assert
Sage Weil [Sun, 30 Sep 2012 22:12:46 +0000 (15:12 -0700)]
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>
13 years agomon: debug recovered_{peon,leader}
Sage Weil [Sun, 30 Sep 2012 21:26:52 +0000 (14:26 -0700)]
mon: debug recovered_{peon,leader}

Signed-off-by: Sage Weil <sage@inktank.com>
13 years agomon: avoid large pass by value in MForward
Sage Weil [Sat, 29 Sep 2012 08:35:36 +0000 (01:35 -0700)]
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>
13 years agomds: fix MDSCacheObject pin printer * logic
Sage Weil [Sat, 29 Sep 2012 08:34:26 +0000 (01:34 -0700)]
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>
13 years agomdsmap: init fields in ctor
Sage Weil [Sat, 29 Sep 2012 08:32:08 +0000 (01:32 -0700)]
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>
13 years agomds: fix potential overflow
Sage Weil [Sat, 29 Sep 2012 08:30:35 +0000 (01:30 -0700)]
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>
13 years agomds: init atid in context
Sage Weil [Sat, 29 Sep 2012 08:29:49 +0000 (01:29 -0700)]
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>
13 years agomds: init log layout in MDCcahe ctor
Sage Weil [Sat, 29 Sep 2012 08:29:00 +0000 (01:29 -0700)]
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>
13 years agomds: simplify get_dirfrag()
Sage Weil [Sat, 29 Sep 2012 08:27:33 +0000 (01:27 -0700)]
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>
13 years agomds: fix mlogger shutdown
Sage Weil [Sat, 29 Sep 2012 08:26:05 +0000 (01:26 -0700)]
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>
13 years agomds: fix leak from get_current_dir_name
Sage Weil [Sat, 29 Sep 2012 08:25:25 +0000 (01:25 -0700)]
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>
13 years agolibrbd: simplify math
Sage Weil [Sat, 29 Sep 2012 08:22:19 +0000 (01:22 -0700)]
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>
13 years agomds: add assert to lock path
Sage Weil [Sat, 29 Sep 2012 08:17:21 +0000 (01:17 -0700)]
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>
13 years agomds: fix uninit Dumper fields in ctor
Sage Weil [Sat, 29 Sep 2012 08:16:16 +0000 (01:16 -0700)]
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>
13 years agomds: fix fd leak in dumper
Sage Weil [Sat, 29 Sep 2012 08:14:58 +0000 (01:14 -0700)]
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>
13 years agomds: fix uninit Capability::last_issue
Sage Weil [Sat, 29 Sep 2012 08:12:53 +0000 (01:12 -0700)]
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>
13 years agomds: fix uninit field in CInode
Sage Weil [Sat, 29 Sep 2012 08:11:41 +0000 (01:11 -0700)]
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>
13 years agomds: fix typo in rsubdirs warning
Sage Weil [Sat, 29 Sep 2012 08:09:43 +0000 (01:09 -0700)]
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>
13 years agomds: init CDir fields
Sage Weil [Sat, 29 Sep 2012 08:08:30 +0000 (01:08 -0700)]
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>
13 years agomds: avoid useless have_inode() call
Sage Weil [Sat, 29 Sep 2012 08:06:38 +0000 (01:06 -0700)]
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>
13 years agoosd: pass by value
Sage Weil [Sat, 29 Sep 2012 07:59:54 +0000 (00:59 -0700)]
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>
13 years agoosd: fix coverity NULL warning
Sage Weil [Sat, 29 Sep 2012 07:57:40 +0000 (00:57 -0700)]
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>
13 years agoosd: logger is never NULL
Sage Weil [Sat, 29 Sep 2012 07:53:28 +0000 (00:53 -0700)]
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>
13 years agoosd/PG: remove redundant NamedState
Sage Weil [Sat, 29 Sep 2012 07:51:08 +0000 (00:51 -0700)]
osd/PG: remove redundant NamedState

Signed-off-by: Sage Weil <sage@inktank.com>
13 years agoosd: init all vars in PG::NamedState
Sage Weil [Sat, 29 Sep 2012 07:50:57 +0000 (00:50 -0700)]
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>
13 years agoceph tool: fix cli test
Sage Weil [Sat, 29 Sep 2012 01:34:26 +0000 (18:34 -0700)]
ceph tool: fix cli test

Signed-off-by: Sage Weil <sage@inktank.com>
13 years agomon: fix uninit var warning in session startup
Sage Weil [Sat, 29 Sep 2012 01:16:49 +0000 (18:16 -0700)]
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>
13 years agofilstore: fix leak of fd in write error paths
Sage Weil [Sat, 29 Sep 2012 01:14:24 +0000 (18:14 -0700)]
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>
13 years agofilestore: fix fd leak
Sage Weil [Sat, 29 Sep 2012 01:12:34 +0000 (18:12 -0700)]
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>
13 years agomds: dentry always has dir
Sage Weil [Sat, 29 Sep 2012 00:56:34 +0000 (17:56 -0700)]
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>
13 years agolibrbd: init value in CopyProgressCtx ctor
Sage Weil [Sat, 29 Sep 2012 00:54:34 +0000 (17:54 -0700)]
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>
13 years agolibrbd: fix overflow assert check
Sage Weil [Sat, 29 Sep 2012 00:53:29 +0000 (17:53 -0700)]
librbd: fix overflow assert check

Signed-off-by: Sage Weil <sage@inktank.com>
13 years agoceph tool: update url in man page
Sage Weil [Sat, 29 Sep 2012 00:38:02 +0000 (17:38 -0700)]
ceph tool: update url in man page

Signed-off-by: Sage Weil <sage@inktank.com>
13 years agoceph tool: document 'ceph osd map ...' command
Sage Weil [Sat, 29 Sep 2012 00:37:53 +0000 (17:37 -0700)]
ceph tool: document 'ceph osd map ...' command

Closes: #3223
Signed-off-by: Sage Weil <sage@inktank.com>
13 years agoMerge remote-tracking branch 'gh/wip-coverity-common'
Sage Weil [Sat, 29 Sep 2012 00:31:41 +0000 (17:31 -0700)]
Merge remote-tracking branch 'gh/wip-coverity-common'

Reviewed-by: Samuel Just <sam.just@inktank.com>
13 years agoMerge branch 'next'
Samuel Just [Fri, 28 Sep 2012 23:31:27 +0000 (16:31 -0700)]
Merge branch 'next'

13 years agoFileStore: use fresh vector for calls for listing collection
Samuel Just [Fri, 28 Sep 2012 23:19:56 +0000 (16:19 -0700)]
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>
13 years agoosdmap: restore stream format
Sage Weil [Fri, 28 Sep 2012 17:31:29 +0000 (10:31 -0700)]
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>
13 years agocephtool: fix resource leak
Sage Weil [Fri, 28 Sep 2012 15:09:09 +0000 (08:09 -0700)]
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>
13 years agocls_refcount: fix uninit vals in ctor
Sage Weil [Fri, 28 Sep 2012 15:06:19 +0000 (08:06 -0700)]
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>
13 years agorados: fix error paths in do_put()
Sage Weil [Fri, 28 Sep 2012 15:03:11 +0000 (08:03 -0700)]
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>
13 years agoosdmaptool: fix pg_t::parse() return value check
Sage Weil [Fri, 28 Sep 2012 14:55:45 +0000 (07:55 -0700)]
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>
13 years agoosdmaptool: check return values
Sage Weil [Fri, 28 Sep 2012 14:55:08 +0000 (07:55 -0700)]
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>
13 years agoobjecter: fix dereference after null check
Sage Weil [Fri, 28 Sep 2012 14:53:04 +0000 (07:53 -0700)]
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>
13 years agoobjectcacher: fix uninit var in ctor
Sage Weil [Fri, 28 Sep 2012 14:45:49 +0000 (07:45 -0700)]
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>
13 years agoobjectcacher: fix uninit it ctor
Sage Weil [Fri, 28 Sep 2012 14:44:18 +0000 (07:44 -0700)]
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>
13 years agoobjectcacher: avoid confusing coverity
Sage Weil [Fri, 28 Sep 2012 14:42:20 +0000 (07:42 -0700)]
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>
13 years agojournaler: uninit var in ctor
Sage Weil [Fri, 28 Sep 2012 14:36:27 +0000 (07:36 -0700)]
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>
13 years agojournaler: uninit var in ctor
Sage Weil [Fri, 28 Sep 2012 14:35:39 +0000 (07:35 -0700)]
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>
13 years agofiler: fix overflow
Sage Weil [Fri, 28 Sep 2012 14:35:20 +0000 (07:35 -0700)]
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>
13 years agoMOSDFailure: avoid big pass by value
Sage Weil [Fri, 28 Sep 2012 14:32:22 +0000 (07:32 -0700)]
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>
13 years agoMMonJoin: avoid large pass by value
Sage Weil [Fri, 28 Sep 2012 14:31:44 +0000 (07:31 -0700)]
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>
13 years agoMRoute: avoid pass by value
Sage Weil [Fri, 28 Sep 2012 14:30:09 +0000 (07:30 -0700)]
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>
13 years agomessages: uninit values
Sage Weil [Fri, 28 Sep 2012 14:29:16 +0000 (07:29 -0700)]
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>
13 years agomsg/Messenger: avoid large pass by value
Sage Weil [Fri, 28 Sep 2012 14:19:38 +0000 (07:19 -0700)]
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>
13 years agomsg/Accepter: check getsockbyname() return value
Sage Weil [Fri, 28 Sep 2012 14:15:07 +0000 (07:15 -0700)]
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>
13 years agoLogEntry: fix uninit in ctor
Sage Weil [Fri, 28 Sep 2012 14:12:39 +0000 (07:12 -0700)]
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>
13 years agoutime: restore ostream state
Sage Weil [Fri, 28 Sep 2012 14:10:05 +0000 (07:10 -0700)]
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>
13 years agostringify: use const ref
Sage Weil [Fri, 28 Sep 2012 14:09:33 +0000 (07:09 -0700)]
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>
13 years agoaddr_parsing: fix memory leak
Sage Weil [Fri, 28 Sep 2012 14:05:27 +0000 (07:05 -0700)]
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>
13 years agopidfile: fix fd leak from pidfile_remove()
Sage Weil [Fri, 28 Sep 2012 14:04:06 +0000 (07:04 -0700)]
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>
13 years agocrushtester: fix uninit var
Sage Weil [Fri, 28 Sep 2012 14:00:12 +0000 (07:00 -0700)]
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>
13 years agocrushtester: avoid divide by zero
Sage Weil [Fri, 28 Sep 2012 13:57:58 +0000 (06:57 -0700)]
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>
13 years agocrushtester: avoid divide by zero
Sage Weil [Fri, 28 Sep 2012 13:56:20 +0000 (06:56 -0700)]
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>
13 years agoadminsocket: fix sock-fd leak in failure path
Sage Weil [Fri, 28 Sep 2012 13:48:11 +0000 (06:48 -0700)]
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>
13 years agoPrebufferedStream: avoid dereferencing end()
Sage Weil [Fri, 28 Sep 2012 13:45:06 +0000 (06:45 -0700)]
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>
13 years agoperfcounters: remove unused members
Sage Weil [Fri, 28 Sep 2012 04:03:02 +0000 (21:03 -0700)]
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>
13 years agoobj_bencher: protect with lock
Sage Weil [Fri, 28 Sep 2012 03:55:37 +0000 (20:55 -0700)]
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>
13 years agoobj_bencher: possible divice by zero
Sage Weil [Fri, 28 Sep 2012 01:21:08 +0000 (18:21 -0700)]
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>
13 years agolockep: fix leak in failure/assert path
Sage Weil [Fri, 28 Sep 2012 01:20:46 +0000 (18:20 -0700)]
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>
13 years agoipaddr: fix buffer overrun on ipv6 prefix of 128
Sage Weil [Fri, 28 Sep 2012 01:17:08 +0000 (18:17 -0700)]
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>
13 years agoconfig: don't leak buf on dump config
Sage Weil [Fri, 28 Sep 2012 01:15:11 +0000 (18:15 -0700)]
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>
13 years agobuffer: init data val in ctor
Sage Weil [Fri, 28 Sep 2012 01:13:24 +0000 (18:13 -0700)]
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>