Snap for 8624184 from baee102002073e746756840dac1dcb6f03d3dfe5 to tm-release

Change-Id: I0be4becfd6ef6b8863eae7f301b3dff9fd8910ab
diff --git a/IdleMaint.cpp b/IdleMaint.cpp
index 2bfe3d9..426be58 100644
--- a/IdleMaint.cpp
+++ b/IdleMaint.cpp
@@ -450,17 +450,17 @@
         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);
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index bc556ef..a7d39c1 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -914,6 +914,10 @@
     updateVirtualDisk();
     mAddedUsers.clear();
     mStartedUsers.clear();
+
+    // Abort all FUSE connections to avoid deadlocks if the FUSE daemon was killed
+    // with FUSE fds open.
+    abortFuse();
     return 0;
 }