Merge "libsnapshot: Don't accidentally delete snapshot when collapsing" am: 48eb2ee176 am: 44d025d928 am: 8786b58b6d am: e3a18c1c2c
am: 83d4d6fd00
Change-Id: I38181a7c09faec00ac5d24c9e8014c46133d13c5
diff --git a/fs_mgr/libsnapshot/snapshot.cpp b/fs_mgr/libsnapshot/snapshot.cpp
index 2da58aa..3820523 100644
--- a/fs_mgr/libsnapshot/snapshot.cpp
+++ b/fs_mgr/libsnapshot/snapshot.cpp
@@ -953,7 +953,7 @@
// flushed remaining I/O. We could in theory replace with dm-zero (or
// re-use the table above), but for now it's better to know why this
// would fail.
- if (!dm.DeleteDeviceIfExists(dm_name)) {
+ if (dm_name != name && !dm.DeleteDeviceIfExists(dm_name)) {
LOG(ERROR) << "Unable to delete snapshot device " << dm_name << ", COW cannot be "
<< "reclaimed until after reboot.";
return false;