Various cleanup changes to session authentication code.

Signed-off-by: Peter Reiher <reiher@inktank.com>
Merge branch 'wip-client-unmount'

Signed-off-by: Noah Watkins <noah.watkins@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Merge branch 'wip-msgauth4'

Conflicts:
	src/common/config_opts.h
	Added a couple of options related to session authentication, accepted new values for option from master
doc: add JavaDoc to Sphinx

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
librbd: fix race in AioCompletion that are still being built

When caching is enabled, it is possible for the io completion to happen
faster than we call ->finish_adding_requests() (e.g., on cache read).
When that happens, the final read request completion doesn't see a
pending_count == 0 and thus doesn't do all the final buffer construction
that is necessary to return correct data.  In particular, users will see
zeroed buffers.  test_librbd_fsx is turning this up consistently after
several thousand ops with an image size of ~100MB and cloning disabled.

This was introduced with the extra logic added here with striping.

Fix this by making a separate flag to indicate the completion is under
construction, and make sure we call complete() when both pending_count==0
and building==false.

Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
osdc/ObjectCacher: rename lru_* -> bh_lru_*

We'll be adding LRUs for objects, too.

Signed-off-by: Sage Weil <sage@inktank.com>
osdc/ObjectCacher: add ref count to Object

Signed-off-by: Sage Weil <sage@inktank.com>
osdc/ObjectCacher: take Object ref when there are buffers

Signed-off-by: Sage Weil <sage@inktank.com>
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>
osdc/ObjectCacher: take Object ref for bh writes

Signed-off-by: Sage Weil <sage@inktank.com>
osdc/ObjectCacher: add LRU for Object

Incomplete; we aren't trimming yet.

Signed-off-by: Sage Weil <sage@inktank.com>
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>
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>
osdc/ObjectCacher: do not close objects explicitly

Let the trimmer do that.

Signed-off-by: Sage Weil <sage@inktank.com>
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>
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>
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>
osdc/ObjectCacher: clear complete on trim, release

Clear the complete flag when we are discarding buffers.

Signed-off-by: Sage Weil <sage@inktank.com>
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>
osdc/ObjectCacher: improve debug output for readx()

Signed-off-by: Sage Weil <sage@inktank.com>