Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28a1969e authored by Eric Biggers's avatar Eric Biggers
Browse files

Remove unneeded 'slave' flag for /data_mirror/data_ce/null

Remove the 'slave' mount flag that was added by commit ef927522
(https://r.android.com/2095463) because it doesn't actually do anything
in this context.  MS_SLAVE can only be used to change the propagation
type of an existing mount, and the kernel ignores it if MS_BIND is also
specified, due to the way the various high-level operations that the
mount() system call can do are prioritized.

The reason that the /data/user/0 mount gets propagated into /data_mirror
anyway is because the /data mount has the "shared" propagation type.  In
the above-mentioned commit I had assumed the default Linux mount
semantics, but actually Android applies the "shared" propagation type to
everything (see SetupMountNamespaces() in init/mount_namespace.cpp).

Test: Booted Cuttlefish and verified (via /proc/self/mountinfo) that
      /data/data is still bind-mounted to both /data/user/0 and
      /data_mirror/data_ce/null/0.
Bug: 156305599
BYPASS_INCLUSIVE_LANGUAGE_REASON=commit message mentioning removed code
Change-Id: Idc45d8dcb3a21d4e8e2e72f4d4dda7286f898127
parent 5e524e28
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -952,9 +952,10 @@ on post-fs-data
    mkdir /data_mirror/data_de/null 0700 root root

    # Bind mount CE and DE data directory to mirror's default volume directory.
    # The 'slave' option (MS_SLAVE) is needed to cause the later bind mount of
    # /data/data onto /data/user/0 to propagate to /data_mirror/data_ce/null/0.
    mount none /data/user /data_mirror/data_ce/null bind rec slave
    # Note that because the /data mount has the "shared" propagation type, the
    # later bind mount of /data/data onto /data/user/0 will automatically
    # propagate to /data_mirror/data_ce/null/0 as well.
    mount none /data/user /data_mirror/data_ce/null bind rec
    mount none /data/user_de /data_mirror/data_de/null bind rec

    # Create mirror directory for jit profiles