Enhanced do_mounts_dm to handle multiple devices