objecter: a major refactoring

Fixes: #7619

Removed the client_lock (that used to pass in as a param) and replaced
it with a read-write lock (completely controlled by the objecter). Also
added a per-session read-write lock. Adapt code to use the new locking
scheme, removed locking where not needed. Replaced various counters to
atomics instead of grabbing the lock for updates. Moved ops to live
under the session.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
Signed-off-by: Sage Weil <sage@inktank.com>
objecter: shard completion_lock

Object ops responses are sharded, lock hashed by object name. This
guarantees ordering on the same object. Cross object order is not
guaranteed anymore.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
objecter: don't serialize responses if there's no object name

This implicitly fixes an issue with the list_objects() being reentrant,
and triggers a lock dependency issue. The better solution would be to
have the callback context specify whether it's reentrant or not, but
will require a much bigger change.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
objecter: Objecter::Op is refcounted

Cancellation of lingerin ops collided with ops that we sent osdmap on,
needed to add a refcount for correct object delete.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
objecter: split objecter initialization

Separate objecter initialization to non cluster related work (e.g.,
internal data structures, other registrations), and to operations that
can initiate cluster interaction. This is so that we don't hit a rare
race where we can get called indirectly from one of the dispatcher callbacks
e.g., into handle_osd_map() when not yet being initialized.
This requires that objecter->init() should be called before
messenger->add_dispatcher_head(), and objecter->start() after it.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>