Merge "fastboot: remove retries on invalid IO iterator in OSX"
diff --git a/fs_mgr/libdm/dm.cpp b/fs_mgr/libdm/dm.cpp
index 1e8c14f..3a9ed9b 100644
--- a/fs_mgr/libdm/dm.cpp
+++ b/fs_mgr/libdm/dm.cpp
@@ -106,6 +106,10 @@
if (!GetDeviceUniquePath(name, &unique_path)) {
LOG(ERROR) << "Failed to get unique path for device " << name;
}
+ // Expect to have uevent generated if the unique path actually exists. This may not exist
+ // if the device was created but has never been activated before it gets deleted.
+ bool need_uevent = !unique_path.empty() && access(unique_path.c_str(), F_OK) == 0;
+
struct dm_ioctl io;
InitIo(&io, name);
@@ -116,7 +120,7 @@
// Check to make sure appropriate uevent is generated so ueventd will
// do the right thing and remove the corresponding device node and symlinks.
- if ((io.flags & DM_UEVENT_GENERATED_FLAG) == 0) {
+ if (need_uevent && (io.flags & DM_UEVENT_GENERATED_FLAG) == 0) {
LOG(ERROR) << "Didn't generate uevent for [" << name << "] removal";
return false;
}