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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>