platform_system_core/fs_mgr/include
Yi-Yo Chiang 28113cf3f6 second-stage-init: Don't move submounts when mounting overlayfs
Right now there is a bug in second-stage-init that screws up the
overlayfs overrides. This happens because:
1. second-stage-init mount_all might be executed in the "bootstrap"
   mount namespace.
2. In order to move (MS_MOVE) submounts in fs_mgr_overlayfs_mount_all(),
   we change the mount propagation type of overridden filesystems to
   MS_PRIVATE.
3. This means that the "default" mount namespace would not receive the
   mount events of the overlayfs overrides.
4. After /data is mounted, init would switch to the "default" namespace.
   This means any new processes spawned after this period would not be
   able to see the overlayfs overrides.

We fix this by changing the mount order of second-stage-init mount_all
to mount the overlayfs override of a partition immediately after the
partition is mounted. This way we don't need to move any submounts as
there can't be any, thus we don't need to set any mountpoint to
MS_PRIVATE so the mount event of the overlayfs would be propagated to
the "default" mount namespace, too.

Bug: 309407859
Bug: 306124139
Test: adb-remount-test
Test: verify that overlayfs tookover successfully from second-stage-init
Change-Id: If2ff4852516292ccbc7abdeebe0e9a7c1c7ba606
2023-11-27 17:16:40 +08:00
..
fs_mgr snapuserd: Allow connecting to the first-stage daemon. 2021-07-27 19:35:29 -07:00
fs_mgr.h Remove dead code from fs_mgr 2023-06-23 09:27:55 -07:00
fs_mgr_dm_linear.h fs_mgr: CreateDmTable takes CreateLogicalPartitionParams 2019-09-11 18:32:57 -07:00
fs_mgr_overlayfs.h second-stage-init: Don't move submounts when mounting overlayfs 2023-11-27 17:16:40 +08:00
fs_mgr_vendor_overlay.h Mount vendor overlay from the system partition 2018-11-01 10:26:12 +09:00