libsnapshot: Don't call RemoveAllSnapshots on normal boot.
This change was made when hardening recovery against libsnapshot bugs,
but was too aggressive. It's causing gsid to start, and due to an issue
in libgsid, get retained indefinitely. Dial it back a bit.
Bug: 397325642
Test: boot, ps -A | grep gsid
Change-Id: If013eb1d9082ca1f98bc4f3a26209af38b07e1cc
diff --git a/fs_mgr/libsnapshot/snapshot.cpp b/fs_mgr/libsnapshot/snapshot.cpp
index 83787df..5aa4cd3 100644
--- a/fs_mgr/libsnapshot/snapshot.cpp
+++ b/fs_mgr/libsnapshot/snapshot.cpp
@@ -351,9 +351,14 @@
LOG(INFO) << "Removing all update state.";
- if (!RemoveAllSnapshots(lock)) {
- LOG(ERROR) << "Could not remove all snapshots";
- return false;
+ if (ReadUpdateState(lock) != UpdateState::None) {
+ // Only call this if we're actually cancelling an update. It's not
+ // expected to yield anything otherwise, and firing up gsid on normal
+ // boot is expensive.
+ if (!RemoveAllSnapshots(lock)) {
+ LOG(ERROR) << "Could not remove all snapshots";
+ return false;
+ }
}
// It's okay if these fail: