SharedPtrRegistry: get_next must not delete while holding the lock


        bool get_next(const K &key, pair<K, VPtr> *next)
    
    may indirectly delete the object pointed by next->second when
    doing :
    
        *next = make_pair(i->first, next_val);
    
    and it will deadlock (EDEADLK) when
    
        void operator()(V *to_remove) {
          {
    	Mutex::Locker l(parent->lock);
    
    tries to acquire the lock because it is already held. The
    Mutex::Locker is isolated in a block and the *next* parameter is set
    outside of the block.
    
    A test case demonstrating the problem is added to test_sharedptr_registry.cc

http://tracker.ceph.com/issues/6117 fixes #6117