This is unused, and mostly broken in that there is no cleanup when there
is a failure. Also, the support in the OSD has been largely removed.
Signed-off-by: Sage Weil <sage@inktank.com>
When we add a bufferhead with zeros to the Object data map, use the new
zero type instead of allocating actual zeros.
Signed-off-by: Sage Weil <sage@inktank.com>
If we observe an ENOENT on a read, set the complete flag. Any dirty
buffers we have will still be in memory, even if the write are in flight,
because the TX state remains pinned until the writes commit. Writes cannot
proceed faster than reads, even though reads may proceed faster than
writes.
Signed-off-by: Sage Weil <sage@inktank.com>
The p iterator points to the next bh, but try_merge_bh() at the end of the
loop might merge that into our result and invalidate the iterator. Fix
this by repeating the lookup on each pass through the loop.
Signed-off-by: Sage Weil <sage@inktank.com>
Wait until we have applied the entire read result to the cache before we
trigger any read completion events. This is a cleaner and safer approach
since we can be sure that the callback won't get blocked again on data we
have but haven't applied yet. It also fixes a crash I just observed where
the completion did a read, called trim(), and invalidated/destroyed the
iterator/bh p was referencing.
Signed-off-by: Sage Weil <sage@inktank.com>
Pull unpinned objects off the LRU in trim(). This never happens currently
due to all the explicit calls to close_object()...
Signed-off-by: Sage Weil <sage@inktank.com>
We assert that if can_close(), the Object isn't pinned in the LRU. This
assumes we did yur get/put refcounting properly, such that the pins are
at least as restrictive as can_close().
Signed-off-by: Sage Weil <sage@inktank.com>
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>
We need to verify that a pool really doesn't exist before erroring out. In
particular, we need to make sure it doesn't exist in an osdmap we haven't
seen yet (future from this client's perspective, but still strictly in the
past). The code to do this before was fragile and broken. A 'map latest'
check would go out for every map epoch we process, and we would clear out
our check state on the first reply. Also, we would have to win the race
to get a check back for the exact map that we have before we would succeed.
Instead:
- If we haven't already done so, ask the monitor for the latest map. This
establishes an upper bound on the current map at the time the request
was queued.
- On reply, make note of this map.
- Thereafter, we can fail the request if at any point we call into the
check_*_pool_dne() helper and the current map is >= that bound map. The
caller performs the actual check for whether the pool exists or not.
Among other things, this fixes testrados_list_parallel.
Signed-off-by: Sage Weil <sage@inktank.com>
Some callers will want to call the stripe method multiple times and
accumulate IO on a single result set. Expose access to the map<> that was
previously internally used for this and do the map -> vector conversion
in a wrapper.
Signed-off-by: Sage Weil <sage@inktank.com>
This is intended to replace the Objecter::_sg_read_finish() monstrosity,
and be reused by the librbd striping code.
Signed-off-by: Sage Weil <sage@inktank.com>
This lets us map backwards, if we need to. Arguably the oid and oloc
don't belong here at all. That can come later.
Signed-off-by: Sage Weil <sage@inktank.com>
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>
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>
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>
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>
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>
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>
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>
When we get a pool_op_reply, we find out which osdmap we need to wait for.
The wait_for_new_map() code was feeding that epoch into
maybe_request_map(), which was feeding it to the monitor with the subscribe
request. However, that epoch is the *start* epoch, not what we want. Fix
this code to always subscribe to what we have (+1), and ensure we keep
asking for more until we catch up to what we know we should eventually
get.
Bug: #3075
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>