From 7618db10380feb6036d0d742fcb19c6cd1b62940 Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Tue, 28 Apr 2015 16:32:55 -0700 Subject: [PATCH] Don't ostensibly back off fstrim but then do it anyway When the mount service isn't up yet, we schedule a retry in the near future, but then mistakenly go ahead and try (unsuccessfully) to do the fstrim immediately anyway. Don't do that. Furthermore, when in this situation make sure to preserve knowledge of any completion callback that may be expecting to hear back about the [eventual] fstrim operation. Change-Id: Ic7cba37b4f850540f6e448168be0c42418039b01 --- services/core/java/com/android/server/MountService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java index 7172ab78b8b88..643ff5f783365 100644 --- a/services/core/java/com/android/server/MountService.java +++ b/services/core/java/com/android/server/MountService.java @@ -580,7 +580,9 @@ class MountService extends IMountService.Stub case H_FSTRIM: { if (!isReady()) { Slog.i(TAG, "fstrim requested, but no daemon connection yet; trying again"); - sendMessageDelayed(obtainMessage(H_FSTRIM), DateUtils.SECOND_IN_MILLIS); + sendMessageDelayed(obtainMessage(H_FSTRIM, msg.obj), + DateUtils.SECOND_IN_MILLIS); + break; } Slog.i(TAG, "Running fstrim idle maintenance");