Commit Graph

21564 Commits

Author SHA1 Message Date
Samuel Just
10e1ac7bb9 PG: uninit var in ctor Scrubber
CID 728001: Uninitialized scalar field (UNINIT_CTOR)At (2): Non-static class
member "epoch_start" is not initialized in this constructor nor in any
functions that it calls.

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-09-25 14:09:32 -07:00
Samuel Just
8e214edc3a PG: big param passed by value, C_PGActivateCommitted
CID 717052: Big parameter passed by value (PASS_BY_VALUE)At (1): Passing
parameter pi of type entity_inst_t (size 152 bytes) by value.

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-09-25 14:09:31 -07:00
Samuel Just
7808e50132 OSDMap: clear setprecision in print_osd_line
CID 727987: Not restoring ostream format (STREAM_FORMAT_STATE)At (5): Changing
format state of stream "out" for category precision without later restoring it.

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-09-25 14:09:28 -07:00
Samuel Just
c683fa876c OSD: big parameter passed by value, send_still_alive
CID 717050: 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: Samuel Just <sam.just@inktank.com>
2012-09-25 14:09:28 -07:00
Sage Weil
61545de3c1 librados: cleanup: use Mutex::Locker
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-25 14:09:28 -07:00
Sage Weil
b5814642ad librados: protect lookup_pool, get_pool_name with lock
Fixes: #2525
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-25 14:09:28 -07:00
Yan, Zheng
681f6140e7 mds: Adjust mydir auth when starting MDS that was stopped cleanly
When starting a MDS that was stopped cleanly, we need manually
adjust mydir's auth. This is because MDS log is empty in this case,
mydir's auth can not be adjusted during log replay.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-09-25 14:09:28 -07:00
Yan, Zheng
37881a32d1 mds: Fix SessionMap::is_any_state()
is_any_state() should return false when the by_state list is empty.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-25 14:09:28 -07:00
Josh Durgin
cd78cd243f rbd: fix leak of dir handle in get_rbd_seq
CID 717098: Resource leak (RESOURCE_LEAK)
At (6): Variable "device_dir" going out of scope leaks the storage it
points to.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:28 -07:00
Josh Durgin
84fa74e67b rbd: fix leak of fd on error when reading an entire file
CID 717100: Resource leak (RESOURCE_LEAK)
At (6): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:28 -07:00
Josh Durgin
2d44a1a3e1 rbd: fix leak of fd when importing an image from a file
CID 719579: Resource leak (RESOURCE_LEAK)
At (7): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:28 -07:00
Josh Durgin
dd10b1e834 secret: close fd on error
CID 717079: Resource leak (RESOURCE_LEAK)
At (6): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:28 -07:00
Josh Durgin
237135275d librados: always free buffer allocated by md_config_t::_get_val
CID 717083: Resource leak (RESOURCE_LEAK)
At (3): Variable "str" going out of scope leaks the storage it points
to.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:27 -07:00
Josh Durgin
e6ced04f40 librados: fix use without NULL check in rados_pool_list
CID 716911: Dereference after null check (FORWARD_NULL)
At (5): Passing null pointer "b" to function "strncat(char *, char
const *, size_t)", which dereferences it. (The dereference is assumed
on the basis of the 'nonnull' parameter attribute.)

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:27 -07:00
Josh Durgin
f35ab0fda8 librados: init everything in default IoCtxImpl ctor
CID 717219: Uninitialized pointer field (UNINIT_CTOR)
At (14): Non-static class member "objecter" is not initialized in this
constructor nor in any functions that it calls.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:27 -07:00
Josh Durgin
68b1fd66e9 rbd: make sure we have a device before trying to unmap
CID 717444: Explicit null dereferenced (FORWARD_NULL)
 At (48): Passing null pointer "devpath" to function
"do_kernel_rm(char const *)", which dereferences it.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:27 -07:00
Josh Durgin
399fc01b62 librbd: fix list for more than 1024 format 2 images
r was not being set in the loop.

CID 716936: Infinite loop (INFINITE_LOOP)
At (1): Top of the loop.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:27 -07:00
Josh Durgin
52943a6a70 librbd: don't allow order to be more than 64
Otherwise it will overflow a uint64_t when shifting.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:27 -07:00
Josh Durgin
74b85e7cdf librbd: use 64-bits to shift order
Order is never actually this high currently, but it be via librbd.

CID 716937: Overflowed return value (INTEGER_OVERFLOW)
At (3): Overflowed or truncated value (or a value computed from an
overflowed or truncated value) "offset" used as return value.

CID 717012: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "1 << obj_order" with type
"int" (32 bits, signed) 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 the left operand to
"uint64_t" before performing the left shift.

CID 717011: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "1 << order" with type
"int" (32 bits, signed) 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 the left operand to
"uint64_t" before performing the left shift.

CID 717013: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "1 << order" with type
"int" (32 bits, signed) 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 the left operand to
"uint64_t" before performing the left shift.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:27 -07:00
Josh Durgin
11da12fa49 librbd: init cookie in WatchCtx ctor
CID 717226: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "cookie" is not initialized in this
constructor nor in any functions that it calls.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:27 -07:00
Josh Durgin
404d45b533 librbd: init m_req in LibrbdWriteback::C_Read ctor
CID 717225: Uninitialized pointer field (UNINIT_CTOR)
At (2): Non-static class member "m_req" is not initialized in this
constructor nor in any functions that it calls.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:27 -07:00
Josh Durgin
38aeb0002e librbd: initialize on-disk header in ImageCtx ctor
CID 717224: Uninitialized scalar field (UNINIT_CTOR)
At (26): Non-static class member field "header.snaps" is not
initialized in this constructor nor in any functions that it calls.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:27 -07:00
Josh Durgin
efb2a57457 librbd: init everything in default AioRequest constructors
CID 717222: Uninitialized pointer field (UNINIT_CTOR)
At (16): Non-static class member "m_hide_enoent" is not initialized
in this constructor nor in any functions that it calls.

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

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:27 -07:00
Josh Durgin
eccf60e40b librbd: fix coverity warnings for AioCompletions
CID 717220: Uninitialized pointer field (UNINIT_CTOR)
At (4): Non-static class member "aio_type" is not initialized in this
constructor nor in any functions that it calls.

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

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 14:09:27 -07:00
Ross Turk
b841df00c0 doc: fix broken link in command reference
Signed-off-by: Ross Turk <ross@inktank.com>
2012-09-25 12:59:42 -07:00
Sage Weil
5f9d01125b Merge remote-tracking branch 'gh/wip-2525'
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 12:39:03 -07:00
Josh Durgin
24ef2ef0c0 librados: init all variables in ctors
C_aio_sparse_read_Ack's members are filled in by the only caller
immediately after construction, so make them arguments to the
constructor.

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

WatchContext: these variables are unused, so remove them.

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

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 12:29:21 -07:00
Samuel Just
4015343f27 PG,osd_types,PGMonitor: make backfill state names more descriptive
PG_STATE_BACKFILL->PG_STATE_BACKFILL_WAIT
and
PG_STATE_BACKFILLING->PG_STATE_BACKFILL

backfill -> wait_backfill
backfill+backfilling -> backfill

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-09-25 11:43:51 -07:00
Samuel Just
1fafd99c16 PG: add CEPH_FEATURE for backfill reservation
Also adds backwards compatibility by just post_event-ing
the RemoteBackfillReserved() rather than sending the
message to an older replica.

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-09-25 11:43:51 -07:00
Samuel Just
3ebf52dfb5 doc/: added documentation for backfill_reservation
Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-09-25 11:43:51 -07:00
Samuel Just
796b9b6c2a osd/: add PG_STATE_BACKFILLING
PG_STATE_BACKFILLING is set when the pg enters the Backfilling state.
That is, +backfilling indicates that the pg has obtained its
reservations and is now actively backfilling.

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-09-25 11:43:51 -07:00
Samuel Just
b54a0a252c osd/: add backfill reservations
Previously, a new osd would be bombarded by backfills from many osds
simultaneously, resulting in excessively high load.  Instead, we
want to limit the number of backfills coming into and going out
from a single osd.

To that end, each OSDService now has two AsyncReserver instances: one
for backfills going from the osd (local_reserver) and one for backfills
going to the osd (remote_reserver).  For a primary to initiate a
backfill, it must first obtain a reservation from its own
local_reserver.  Then, it must obtain a reservation from the backfill
target's remote_reserver via a MBackfillReserve message. This process is
managed by substates of Active and ReplicaActive (see the changes in
PG.h).  The reservations are dropped either on the Backfilled event,
which is sent on the primary before calling recovery_complete and on the
replica on receipt of the BackfillComplete progress message), or upon
leaving Active or ReplicaActive.

It's important that we always grab the local reservation before the
remote reservation in order to prevent a circular dependency.

Signed-off-by: Samuel Just <sam.just@inktank.com>
2012-09-25 11:43:47 -07:00
Josh Durgin
fa21924944 test_librbd_fsx: add missing break statement
Fortunately we never used the -m option.

CID 716962: Missing break in switch (MISSING_BREAK)
At (1): This case (value 109) is not terminated by a 'break'
statement. # (use "git add <file>..." to update what will be
committed)

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 10:51:57 -07:00
Josh Durgin
c2cf8eb79e librbd: assert overflow will not happen
CID 716937: Overflowed return value (INTEGER_OVERFLOW)
At (3): Overflowed or truncated value (or a value computed from an
overflowed or truncated value) "offset" used as return value.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-25 10:42:38 -07:00
Yehuda Sadeh
e653816e86 rgw: url_decode should allocate extra byte for dest
Was missing extra byte for null termination

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
2012-09-25 08:49:27 -07:00
Yan, Zheng
200ed2b3f0 mds: Adjust mydir auth when starting MDS that was stopped cleanly
When starting a MDS that was stopped cleanly, we need manually
adjust mydir's auth. This is because MDS log is empty in this case,
mydir's auth can not be adjusted during log replay.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
2012-09-25 07:33:57 -07:00
Yan, Zheng
0571535961 mds: Fix SessionMap::is_any_state()
is_any_state() should return false when the by_state list is empty.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-24 20:29:18 -07:00
Josh Durgin
df59a0699a Merge branch 'wip-rbd-coverity'
Reviewed-by: Sage Weil <sage.weil@inktank.com>
2012-09-24 18:16:28 -07:00
Josh Durgin
1747c1c1dc rbd: fix leak of dir handle in get_rbd_seq
CID 717098: Resource leak (RESOURCE_LEAK)
At (6): Variable "device_dir" going out of scope leaks the storage it
points to.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-24 17:57:33 -07:00
Josh Durgin
55f72301ba rbd: fix leak of fd on error when reading an entire file
CID 717100: Resource leak (RESOURCE_LEAK)
At (6): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-24 17:57:33 -07:00
Josh Durgin
5b22c1d68d rbd: fix leak of fd when importing an image from a file
CID 719579: Resource leak (RESOURCE_LEAK)
At (7): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-24 17:57:33 -07:00
Josh Durgin
2c1b7f2c5d secret: close fd on error
CID 717079: Resource leak (RESOURCE_LEAK)
At (6): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-24 17:57:33 -07:00
Josh Durgin
4567a6df2f librados: always free buffer allocated by md_config_t::_get_val
CID 717083: Resource leak (RESOURCE_LEAK)
At (3): Variable "str" going out of scope leaks the storage it points
to.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-24 17:57:33 -07:00
Josh Durgin
a677f47926 librados: fix use without NULL check in rados_pool_list
CID 716911: Dereference after null check (FORWARD_NULL)
At (5): Passing null pointer "b" to function "strncat(char *, char
const *, size_t)", which dereferences it. (The dereference is assumed
on the basis of the 'nonnull' parameter attribute.)

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-24 17:42:13 -07:00
Josh Durgin
a5c7776144 librados: init everything in default IoCtxImpl ctor
CID 717219: Uninitialized pointer field (UNINIT_CTOR)
At (14): Non-static class member "objecter" is not initialized in this
constructor nor in any functions that it calls.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-24 17:42:13 -07:00
Josh Durgin
ee1fe151e7 rbd: make sure we have a device before trying to unmap
CID 717444: Explicit null dereferenced (FORWARD_NULL)
 At (48): Passing null pointer "devpath" to function
"do_kernel_rm(char const *)", which dereferences it.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-24 17:42:13 -07:00
Josh Durgin
a204058a9a librbd: fix list for more than 1024 format 2 images
r was not being set in the loop.

CID 716936: Infinite loop (INFINITE_LOOP)
At (1): Top of the loop.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-24 17:42:13 -07:00
Josh Durgin
7df76de6ac librbd: don't allow order to be more than 64
Otherwise it will overflow a uint64_t when shifting.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-24 17:42:05 -07:00
Josh Durgin
118c21276c librbd: use 64-bits to shift order
Order is never actually this high currently, but it be via librbd.

CID 716937: Overflowed return value (INTEGER_OVERFLOW)
At (3): Overflowed or truncated value (or a value computed from an
overflowed or truncated value) "offset" used as return value.

CID 717012: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "1 << obj_order" with type
"int" (32 bits, signed) 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 the left operand to
"uint64_t" before performing the left shift.

CID 717011: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "1 << order" with type
"int" (32 bits, signed) 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 the left operand to
"uint64_t" before performing the left shift.

CID 717013: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "1 << order" with type
"int" (32 bits, signed) 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 the left operand to
"uint64_t" before performing the left shift.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-24 17:41:51 -07:00
Josh Durgin
cd3d3aa692 librbd: init cookie in WatchCtx ctor
CID 717226: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "cookie" is not initialized in this
constructor nor in any functions that it calls.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-24 17:41:49 -07:00