HAMMER - Fix cursor tracking bugs and a few other issues
* When recursively removing empty internal nodes from the B-Tree only
call hammer_cursor_deleted_element() if the related internal
element is actually removed. The element might not be removed due
to the deadlock fail path.
* If hammer_cursor_up_locked() fails fully restore the cursor before
returning. The index field was not being restored.
* Acquire the sync lock when recovering a cursor lost due to a deadlock
in the mirroring code.
* Document and fix an issue in the rebalancing code which could cause a
cursor to fall off the end of the B-Tree.
Reported-by: YONETANI Tomokazu <qhwt+dfly@les.ath.cx>