ceph: add check_session_state() helper and make it global