From 817f224fb466a8ddad358cc7d031f13beed340d2 Mon Sep 17 00:00:00 2001 From: Zim Date: Thu, 19 May 2022 16:53:22 +0100 Subject: [PATCH] Abort FUSE as part of volume reset This fixes a bug in Android T where MediaProvider leaked FUSE fds in it's process preveventing it from dying after being killed. This resulted in the MP in a zombie state. Even though, this bug was more prevalent in Android T due to a change in the Parcel lifecycle (see b/233216232), this bug could have always occurred in theory. This fix should be harmless since after volume reset, all FUSE volumes should be unmounted and aborting the FUSE connections will either no-op or actually prevent the FUSE daemon from getting wedged in a zombie state. Test: Manually trigger a FUSE fd leak in the MediaProvider, kill it and verify that it is restarted without zombie. Bug: 233216232 Bug: 231792374 Bug: 230445008 Change-Id: I9e559a48b9a72e6ecbc3a277a09ea5d34c9ec499 --- VolumeManager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/VolumeManager.cpp b/VolumeManager.cpp index bc556ef..a7d39c1 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -914,6 +914,10 @@ int VolumeManager::reset() { 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; }