From e69b2d427754fa1d9d2758c8068f0adda75095bf Mon Sep 17 00:00:00 2001 From: Akilesh Kailash Date: Tue, 8 Oct 2024 20:53:06 -0700 Subject: [PATCH] snapshotctl: Initialize snapshot pointer when reverting snapshots Test: snapshotctl revert-snapshots Bug: 368487904 Change-Id: I9743bf412d4bfcf508aeb046ec329568da4e2be1 Signed-off-by: Akilesh Kailash --- fs_mgr/libsnapshot/snapshotctl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs_mgr/libsnapshot/snapshotctl.cpp b/fs_mgr/libsnapshot/snapshotctl.cpp index 97a8cb210..46de991d0 100644 --- a/fs_mgr/libsnapshot/snapshotctl.cpp +++ b/fs_mgr/libsnapshot/snapshotctl.cpp @@ -105,7 +105,7 @@ class MapSnapshots { bool FinishSnapshotWrites(); bool UnmapCowImagePath(std::string& name); bool DeleteSnapshots(); - bool CleanupSnapshot() { return sm_->PrepareDeviceToBootWithoutSnapshot(); } + bool CleanupSnapshot(); bool BeginUpdate(); bool ApplyUpdate(); @@ -495,6 +495,11 @@ bool MapSnapshots::UnmapCowImagePath(std::string& name) { return sm_->UnmapCowImage(name); } +bool MapSnapshots::CleanupSnapshot() { + sm_ = SnapshotManager::New(); + return sm_->PrepareDeviceToBootWithoutSnapshot(); +} + bool MapSnapshots::DeleteSnapshots() { sm_ = SnapshotManager::New(); lock_ = sm_->LockExclusive();