multipathd: move recovery mode code to function