fs_mgr_overlayfs: Fix submount propagation type after remount
When juggling submounts, the temp dir holding the references to submounts should be MS_PRIVATE. Otherwise the submount propagation type would be changed according to section 5d, https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt For example, a root mount tree of <mountpoint> <shared/private> /dev shared /product shared /product/app private When executing "remount /product", "/product/app" would be moved to a temp dir under "/dev", which is MS_SHARED. This would also change the state of the mount to MS_SHARED. /dev shared /product shared /dev/temp shared (moved from /product/app) Thus after "/product" overlay is mounted, and "/dev/temp" is moved back, "/product/app" would be unintentionally changed to MS_SHARED. /dev shared /product private /product shared (overlayfs override) /product/app shared (moved from /dev/temp) This change fixes this issue by setting up a standalone mount tree under /dev to hold the temporary moved submounts. This way we don't need to modify the state of "/dev" whatsoever, and can guarantee the propagation type of mounts moved in and out of the temp dir are not changed. Bug: 306124139 Test: adb-remount-test Test: remount a parent mount and then verify the mount flag of submount Change-Id: I8174257cff6b93dd95303c6ab49b42f90b02df0c
Loading
Please register or sign in to comment