common/Timer: recheck stopping before sleep if we dropped the lock

If we have safe_callbacks==false, the stopping flag may have changed while
we were doing our callback. Recheck it and exit to avoid a deadlock on
shutdown.

Signed-off-by: Sage Weil <sage@redhat.com>
osdc/Objecter: fix tick_event handling in shutdown vs tick race

If we fail to cancel the tick_event, we rely on tick() itself to clear
tick_event.  I'm not quite sure how we got this wrong in the previous
commit, but this boils down to two cases:

1) shutdown() successfully cancels the event and clears tick_event.  tick()
   never runs.  tick_event == NULL when we finish.
2) shutdown() fails to cancel the event because it has already started.  In
   this case tick itself is blocking (or about to block) waiting on the
   rlock.  When it does run it will clear tick_event itself, then see
   initiazed == 0 and exit without rescheduling.

Fixes: #9873
Signed-off-by: Sage Weil <sage@redhat.com>
Merge pull request #2795 from ceph/wip-9873

objecter: fix tick_event shutdown race (9873)

Reviewed-by: David Zafman <dzafman@redhat.com>