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
This commit is contained in:
Zim 2022-05-19 16:53:22 +01:00 committed by Zimuzo Ezeozue
parent c0de6d8184
commit 817f224fb4

View file

@ -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;
}