Devmapper cleanup and unmount fix

This has some cleanup of the devmapper code and fixes two problems that cause unmount to intemittently fail.