Merge "libsnapshot: Don't accidentally delete snapshot when collapsing"

am: 48eb2ee176

Change-Id: Ibe795625cd858e7cf72dc0a7ac4d08bf2f081d7b
This commit is contained in:
Yifan Hong 2019-09-04 13:08:13 -07:00 committed by android-build-merger
commit 44d025d928

View file

@ -953,7 +953,7 @@ bool SnapshotManager::CollapseSnapshotDevice(const std::string& name,
// 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;