vold: fix the range of stopped state of idleMaint

When it is stuck in runDevGC() for an unexpected reason, now it cannot
prevent the other callers from entering into it again. Fix it.

Bug: 232297944
Test: run "sm idle-maint run" twice & check whether they are overlapped
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Change-Id: I785c8aeebd8fcf58c34d9be9968d99634d0b420a
Merged-In: I785c8aeebd8fcf58c34d9be9968d99634d0b420a
This commit is contained in:
Daeho Jeong 2022-05-18 09:03:15 -07:00
parent e07afb81e2
commit 7667d64ab8

View file

@ -450,17 +450,17 @@ int RunIdleMaint(bool needGC, const android::sp<android::os::IVoldTaskListener>&
stopGc(paths);
}
if (!gc_aborted) {
Trim(nullptr);
runDevGc();
}
lk.lock();
idle_maint_stat = IdleMaintStats::kStopped;
lk.unlock();
cv_stop.notify_one();
if (!gc_aborted) {
Trim(nullptr);
runDevGc();
}
if (listener) {
android::os::PersistableBundle extras;
listener->onFinished(0, extras);