Commit Graph

671 Commits

Author SHA1 Message Date
Sage Weil
84c7a34b51 osdc/ObjectCacher: remove dead locking code
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>
2012-10-27 13:56:24 -07:00
Sage Weil
1de33053ae osdc/ObjectCacher: handle zero bufferheads on read
Interpret a zero bufferhead as zeros in _readx().

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:56:05 -07:00
Sage Weil
94a84d2908 osdc/ObjectCacher: add ZERO bufferheads from map_read()
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>
2012-10-26 11:56:05 -07:00
Sage Weil
fde7fe6840 osdc/ObjectCacher: add zero bufferhead state
Wired up, but not yet used.

Treat these as clean.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:55:47 -07:00
Sage Weil
45946c2fe9 osdc/ObjectCacher: some extra debugging
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:33:53 -07:00
Sage Weil
fdf556a31e osdc/ObjectCacher: fill in zero buffers in map_read() on miss if complete
If we know we have the complete object in cache, fill in zero buffers
when we miss.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:31:45 -07:00
Sage Weil
9dc887d660 osdc/ObjectCacher: improve debug output for readx()
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:31:45 -07:00
Sage Weil
b9b1be6d68 osdc/ObjectCacher: set complete flag when we observe ENOENT
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>
2012-10-26 11:31:45 -07:00
Sage Weil
94d2b91d5b osdc/ObjectCacher: clear complete on trim, release
Clear the complete flag when we are discarding buffers.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:31:45 -07:00
Sage Weil
ab56e41997 osdc/ObjectCacher: add complete flag
This is set when we know we have *all* the data for this object.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:31:45 -07:00
Sage Weil
f3db940f05 osdc/ObjectCacher: refresh iterator in read apply loop
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>
2012-10-26 11:31:45 -07:00
Sage Weil
e287296584 osdc/ObjectCacher: do read completions after assimilating read result
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>
2012-10-26 11:31:45 -07:00
Sage Weil
9407046dc7 osdc/ObjectCacher: do not close objects explicitly
Let the trimmer do that.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:31:45 -07:00
Sage Weil
8920f417bf osdc/ObjectCacher: make trim() trim Objects
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>
2012-10-26 11:31:45 -07:00
Sage Weil
f241e22f52 osdc/ObjectCacher: check lru_is_expireable() in can_close()
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>
2012-10-26 11:31:44 -07:00
Sage Weil
cd8e991af8 osdc/ObjectCacher: add LRU for Object
Incomplete; we aren't trimming yet.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:31:44 -07:00
Sage Weil
46897fd4ff osdc/ObjectCacher: take Object ref for bh writes
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:31:44 -07:00
Sage Weil
21dc0e0262 osdc/ObjectCacher: take refs for inflight lock ops
These are all dead/unused; should probably just rip out this code!

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:31:44 -07:00
Sage Weil
57e18a74fe osdc/ObjectCacher: take Object ref when there are buffers
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:31:44 -07:00
Sage Weil
a34a8b8bae osdc/ObjectCacher: add ref count to Object
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:31:44 -07:00
Sage Weil
24d07e8727 osdc/ObjectCacher: rename lru_* -> bh_lru_*
We'll be adding LRUs for objects, too.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-26 11:31:44 -07:00
Sage Weil
2d20f3a8a4 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>
2012-10-21 21:07:12 -07:00
Sage Weil
ddde1c8f6a Merge branch 'wip-testrados'
Lightly-reviewed-by: Josh Durgin <josh.durgin@inktank.com>
2012-10-21 09:01:33 -07:00
Sage Weil
cce58a31e8 objecter: refactor pool dne checks
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>
2012-10-16 17:52:25 -07:00
Sage Weil
dc2ec37800 objecter: fix handling for pool DNE on pgls
Fix check for whther the pool exists for pgls.  This was broken ages ago by
e0ec286501.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-16 17:52:25 -07:00
Sage Weil
d68a80622c striper: expose method that works directrly from a map<>
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>
2012-10-15 15:34:07 -07:00
Sage Weil
5599eb7c82 Striper: move from Filer
Move all the static striping code from Filer to Striper.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-15 15:34:06 -07:00
Sage Weil
e6c98e94dc filer: more debug output
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-15 15:34:06 -07:00
Sage Weil
b4f28292c2 filer: fix add_partial_sparse_result
Fix advancement of bl_off, and handling of case where bl has no more bytes
to consume.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-15 15:34:06 -07:00
Sage Weil
819f93916a filer: add debug printability for striped read result stuff
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-15 15:34:06 -07:00
Sage Weil
80ebceea58 filer: uninline StripedReadResult
Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-15 15:34:06 -07:00
Sage Weil
9e109e187c filer: add sparse result into a striped read result
Add a helper to assimilate a sparse read result into the destriper
helper class.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-15 15:34:04 -07:00
Sage Weil
08d1eb5b0b filer: make tail zeroing in stripe result assembly optional
Objecter doesn't want it, librbd will.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-15 15:34:04 -07:00
Sage Weil
3d010fc4c8 objecter: use StripedReadResult for scatter/gather read
This vastly simplifies the code, and uses the more generic helper class.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-15 15:34:04 -07:00
Sage Weil
3c2024de44 filer: helper to assemble striped read results into a single result
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>
2012-10-15 15:34:04 -07:00
Sage Weil
827ad53aba filer: add optional buffer offset
It may be that some range is being mapped that is intended for some offset
within the result buffer.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-15 15:34:04 -07:00
Sage Weil
c85b9016ea filer: add helper to map from object extent to file extents
Given an extent in an object and a layout, map it back to extent(s) in the
original file.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-15 15:34:03 -07:00
Sage Weil
c3f186e678 filer: use vector<pair<>> instead of map<> for buffer extent map
This is less inefficient.  :)

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-15 15:34:03 -07:00
Sage Weil
058c24ffea filer: include (numeric) objectno in ObjectExtent
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>
2012-10-15 15:34:03 -07:00
Sage Weil
d54ca6720e filer: generalize file_to_extents to take a format string
Allow any format string to be used, so long as it takes a long long
unsigned.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-10-15 15:34:03 -07:00
Sage Weil
0b3c5dc58c 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>
2012-09-28 13:18:06 -07:00
Sage Weil
b1d85130d1 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>
2012-09-28 13:18:06 -07:00
Sage Weil
62273b5cbf 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>
2012-09-28 13:18:06 -07:00
Sage Weil
e5103b44bc 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>
2012-09-28 13:18:06 -07:00
Sage Weil
a1f9dbc690 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>
2012-09-28 13:18:06 -07:00
Sage Weil
7b90139f4e 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>
2012-09-28 13:18:06 -07:00
Sage Weil
50460f90f5 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>
2012-09-28 13:18:06 -07:00
Greg Farnum
d77205d8f9 objecter: remove the now-unused "registering" flag on LingerOps
Signed-off-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
2012-09-07 21:03:39 -07:00
Samuel Just
a0c87b8675 Merge remote-tracking branch 'upstream/wip-kvstore' 2012-09-05 10:50:50 -07:00
Sage Weil
e09b26555c objecter: fix osdmap wait
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>
2012-09-04 11:29:21 -07:00