Commit graph

3273 commits

Author SHA1 Message Date
Martijn Coenen
fd7362d2a8 Correctly initialize mFuseMounted.
Wasn't done before.

Bug: 137890172
Test: builds
Change-Id: I413505fae23031a2da71086cbfd85e0b1aec459c
2019-12-11 14:26:27 +00:00
Martijn Coenen
745e0a9acb Use a regular set for started users.
We want started users to be an ordered set; eg user 0 should always go
first. This is because volumes for users other than 0 depend on user 0
coming up first, because the volume for user 0 is the one mounting
sdcardfs.

Bug: 13789012
Test: atest AdoptableHostTest
Change-Id: Ic9119f0a24bd261e5362019836ac240b90c681c0
2019-12-10 16:49:16 +01:00
Martijn Coenen
8f1e7f289f When unmounting, only kill user-specific paths.
The path for emulated volumes is set to /storage/emulated,
not /storage/emulated/<userid> . When unmounting, we only
want to kill process with a reference to /<userid>; this prevents
killing processed needlessly.

Bug: 137890172
Test: atest AdoptableHostTest
Change-Id: I70e36e87077e87db9b3c7e07dc0e481ba06c2c14
2019-12-10 16:49:16 +01:00
Martijn Coenen
5700261e5a Bind mount Android/ directory in FUSE.
For apps seeing the FUSE filesystem, we want to bind-mount the Android/
directory to the lower filesystem. The main reason for this is game
performance - Android/ contains both OBBs and app-private external data,
and both are heavily accessed during game startup. This is a pretty
straightforward bind-mount on top of /mnt/user.

Bug: 137890172
Test: Running the following:
df /storge/emulated/0 ==> /dev/fuse (FUSE)
df /storage/emulated/0/Android ==> /data/media (sdcardfs)
Test: atest AdoptableHostTest

Change-Id: Ic17a5751b5a94846ee565ff935644a078044ab06
2019-12-10 16:49:16 +01:00
Martijn Coenen
6f5802e160 Use sdcardfs for pass-through mounts.
The pass-through mount is used by MediaProvider to access external
storage. Previously, it was the raw filesystem (eg ext4/f2fs); the
problem with that is that the permissions on that filesystem don't allow
MediaProvider to access all the files it needs to - in particular
directories under Android/

To solve this problem, we can have the pass-through mount sit on top of
sdcardfs instead of the raw filesystem. This means we need to mount
sdcardfs even in case we're using FUSE, but we already needed to do this
anyway for other performance reasons.

Bug: 135341433
Test: atest AdoptableHostTest
Change-Id: I893d5e5076c5096d2d55212f643c9a857242e964
2019-12-10 16:49:16 +01:00
Oli Lan
9072cef152 Merge changes from topics "createapexdirs", "createapexrollbackdirs" am: 3e1c0478b9 am: 0ad91e40ea
am: f243a3b105

Change-Id: I29b4de125231880894571a003791f02c58ce1049
2019-12-10 05:09:30 -08:00
Oli Lan
0c871647ff Create DE_n and CE_n APEX data directories. am: 94457217cb am: e7216f643d
am: 3f26f52ede

Change-Id: I0ce19d096e41b7a3879a1c63a211fc62ee7b93e0
2019-12-10 05:09:26 -08:00
Oli Lan
f243a3b105 Merge changes from topics "createapexdirs", "createapexrollbackdirs" am: 3e1c0478b9
am: 0ad91e40ea

Change-Id: I63e3a68a9d197c89aa195409c9847d6334f1dd14
2019-12-10 05:07:29 -08:00
Oli Lan
3f26f52ede Create DE_n and CE_n APEX data directories. am: 94457217cb
am: e7216f643d

Change-Id: I2afb35d4744224f19e3dafb327ba26f3348e09a5
2019-12-10 05:07:26 -08:00
Oli Lan
0ad91e40ea Merge changes from topics "createapexdirs", "createapexrollbackdirs"
am: 3e1c0478b9

Change-Id: I8ec5a0d3d1519eec788604dbaa5e41b869b8d428
2019-12-10 05:04:20 -08:00
Oli Lan
e7216f643d Create DE_n and CE_n APEX data directories.
am: 94457217cb

Change-Id: I5e2a86ae85152b2ea36547783a86ccae654eb6ea
2019-12-10 05:04:17 -08:00
Oli Lan
3e1c0478b9 Merge changes from topics "createapexdirs", "createapexrollbackdirs"
* changes:
  Create directories for snapshots of DE_n and CE_n apex data.
  Create DE_n and CE_n APEX data directories.
2019-12-10 12:54:43 +00:00
Martijn Coenen
90d2652438 Merge "Get rid of confusing FUSE variables and comments." 2019-12-09 18:39:49 +00:00
Martijn Coenen
adcc845231 Get rid of confusing FUSE variables and comments.
Long before scoped storage, FUSE was used to create several views of the
filesystem; this was later replaced by sdcardfs, yet the code still
references FUSE in variables and log messages. Fix those up to avoid
confusion with the "new FUSE".

Bug: 135341433
Test: atest AdoptableHostTest
Change-Id: I2966c5f95d6f38df36a20cdfdd0b95b3051f3f1e
2019-12-09 16:52:15 +01:00
Songchun Fan
0583015a57 Merge "[incremental] use vold to mount/unmount IncrementalFileSystem" am: 6bdfb77d8b am: a0945f468a
am: 1119bc8531

Change-Id: I772667d5c43cdf1ff37b156db9f47b61820433c7
2019-12-06 01:16:26 -08:00
Songchun Fan
1119bc8531 Merge "[incremental] use vold to mount/unmount IncrementalFileSystem" am: 6bdfb77d8b
am: a0945f468a

Change-Id: I4244844cde78dc46cac88299fa1fd2e2eee9af26
2019-12-06 00:05:07 -08:00
Songchun Fan
a0945f468a Merge "[incremental] use vold to mount/unmount IncrementalFileSystem"
am: 6bdfb77d8b

Change-Id: Ic9abd7f6e502e9f051effa998e3fbd40746d57d7
2019-12-06 00:03:15 -08:00
Songchun Fan
6bdfb77d8b Merge "[incremental] use vold to mount/unmount IncrementalFileSystem" 2019-12-06 06:45:37 +00:00
Songchun Fan
ab55cecdc1 [incremental] use vold to mount/unmount IncrementalFileSystem
Let vold mount IncFs onto directories under data and open control files.

Test: builds
Change-Id: Ibd96aae254b4fefaf56c9d549c4672a987c46221
2019-12-04 14:01:22 -08:00
Automerger Merge Worker
72edc7fa35 Merge "Add '/system/bin/vdc volume reset' command" am: d21a8a495d am: 961806fdc9
Change-Id: Ib62cb7e0a63e9a3f182631f1ac3ee108607b95d1
2019-12-04 20:38:58 +00:00
Nikita Ioffe
961806fdc9 Merge "Add '/system/bin/vdc volume reset' command" am: d21a8a495d
am: 86bad28329

Change-Id: I589bc0973050eea50147f927cf2044949ca4d7e0
2019-12-04 12:18:28 -08:00
Nikita Ioffe
86bad28329 Merge "Add '/system/bin/vdc volume reset' command"
am: d21a8a495d

Change-Id: I21fde79cd170bdfcd8a32b8a85da56099a223e2d
2019-12-04 11:52:20 -08:00
Nikita Ioffe
d21a8a495d Merge "Add '/system/bin/vdc volume reset' command" 2019-12-04 19:22:50 +00:00
Martijn Coenen
10b122b4e9 Don't LOG() after fork() and before exec().
LOG() can hang, because another vold thread may have been holding
a libc lock at the time we forked. Simply moving the log line to
before the fork().

Bug: 135341433
Test: atest AdoptableHostTest
Change-Id: I6063eb33f35c835a226bc1e56de97ace426747ff
2019-12-04 15:50:29 +01:00
Oli Lan
ac003c4955 Create directories for snapshots of DE_n and CE_n apex data.
This creates apexrollback directories under /data/misc_[de|ce]/<user>
which will hold snapshots of DE_n and CE_n apex data directories
(i.e. it will hold backups of data from /data/misc_[de|ce]/<user>/apexdata
for particular apexes).

See go/apex-data-directories for details.

Bug: 141148175
Test: Built and flashed, checked directory was created.
Change-Id: I468060b20dee0c50033b5f014ce8716582d5e6bc
2019-12-04 10:29:50 +00:00
Nikita Ioffe
7596581e9f Add '/system/bin/vdc volume reset' command
It will be used during the userspace reboot to unmount all emulated
storages, which is a prerequisite to unmount+remount ext4 userdata into
checkpoint mode.

Test: adb shell /system/bin/vdc checkpoint startCheckpoint 1
Test: adb reboot userspace
Bug: 143970043
Bug: 135984674
Change-Id: I07491bc4be2f30debe21b764766c9def68548e16
2019-12-02 11:51:20 +00:00
TreeHugger Robot
7e170b919e Merge "VolumeManager: limit the scope of remountUid post fork." 2019-11-28 10:18:08 +00:00
TreeHugger Robot
8b4b452c80 Merge "Allow null IVoldMountCallback in Vold#mount" 2019-11-27 19:22:29 +00:00
Zim
9d1425c09b Allow null IVoldMountCallback in Vold#mount
Test: m
Bug: 145231499
Change-Id: I51cb4424d821078a3604d5b3a42e99d3aaf658c3
2019-11-27 18:16:25 +00:00
Narayan Kamath
02efdf55d2 VolumeManager: limit the scope of remountUid post fork.
We want to be sure we're not allocating memory, holding locks
or otherwise preventing the child process from making progress.

This is a temporary fix of limited scope. In the medium term, it
would be preferable to exec a binary that performs this work for us
as soon as we fork.

Test: manual
Bug: 141678467

Change-Id: I57dbd9b3c887aa27e2dd609abf0ad43c66f4ef2a
2019-11-27 12:48:35 +00:00
TreeHugger Robot
fe83792eec Merge "Don't automatically start user 0." 2019-11-25 15:24:56 +00:00
Martijn Coenen
c659b0a8bf Merge "Add mount callback" 2019-11-25 13:00:54 +00:00
Martijn Coenen
54bf4c03d1 Don't automatically start user 0.
It's the responsibility of the StorageManagerService to send down
started users after a reset(); and with the latest multi-user FUSE
changes, the manual start is no longer necessary.

Bug: 135341433
Test: atest AdoptableHostTest

Change-Id: I3c9c1d7c25ad10787212d7902fa3f1878ee5f896
2019-11-22 17:06:07 +01:00
Zim
5048b4b2bc Add mount callback
Mounting a FUSE path needs two steps:
1. Mounting the filesystem
2. Starting the FUSE session in the FUSE daemon

The second part requires retriving an fd from (1) and the mount paths
and passing it to the FUSE daemon.

Previously, we'd return from the Vold mount call and mark the volume
as mounted while we scramble to do (2). This means there's a time
period where the Volume is marked as MOUNTED but not actually ready
and any IO access on the paths will hang forever. This could also be
misleading when interpreting bug reports.

Now, we block the Vold mount call until the FUSE session is started

Test: atest AdoptableHostTest
Bug: 144275217

Change-Id: I45238a31df71286f67ef1c65c711d0085d72e97f
2019-11-22 17:06:04 +01:00
Oli Lan
94457217cb Create DE_n and CE_n APEX data directories.
This creates an apexdata directory under /data/misc_de/<user> and
/data/misc_ce/<user>, and also creates a directory under that for
every APEX that is installed.

See go/apex-data-directories.

APEXes are discovered by scanning the /apex directory. It may be better
to delegate this process to a library, but it is proposed to defer that
change to a future CL.

Bug: 141148175
Test: Built and flashed, checked directories were created.
Change-Id: I95a060b4f42241c91da25a779e61a8f85ca1914c
2019-11-21 14:07:18 +00:00
Janis Danisevskis
2466ef7671 Merge "Removed obsolete Test" am: 6e3441a8ea am: 9f5f518c19
am: ffe6756d10

Change-Id: I514c9bd97c6aca3020687941e695db4e3f134e92
2019-11-18 16:37:15 -08:00
Janis Danisevskis
ffe6756d10 Merge "Removed obsolete Test" am: 6e3441a8ea
am: 9f5f518c19

Change-Id: I39bccf96f352b1000f2fdd64ffff92e20bbfc340
2019-11-18 16:28:28 -08:00
Janis Danisevskis
9f5f518c19 Merge "Removed obsolete Test"
am: 6e3441a8ea

Change-Id: I392f1737c5dfa6e7aee78c7b1af1b016f6f102e9
2019-11-18 16:22:14 -08:00
Treehugger Robot
6e3441a8ea Merge "Removed obsolete Test" 2019-11-19 00:11:11 +00:00
Janis Danisevskis
8c4eb2c2c0 Removed obsolete Test
The HidlizationEquivalenceTest was used to make sure the same key is
computed by the scrypt algorithm regardless of whether the old
(<= KM2 HAL pre treble) or the new (>= KM3.0 treble) HAL was used.
Since the treble is now the default, and old HAL don't even exist on
new devices, we should call the migration a success and drop this test
altogether.

Test: Removed obsolete Code
Bug: 68197448
Change-Id: If10c79bafac4d0c8268675cbb8e1c4b46974aab5
2019-11-18 22:53:30 +00:00
TreeHugger Robot
d88f536a5a Merge "Fix wrong symlink terminology" 2019-11-18 12:49:16 +00:00
Zimuzo Ezeozue
9da067b08b Merge "Add zezeozue to OWNERS" am: f9972055f5 am: e8db702702
am: b287ea6a02

Change-Id: I325fa3adab62d11c228be5b79c75f1cd9034453a
2019-11-15 08:39:38 -08:00
Zimuzo Ezeozue
b287ea6a02 Merge "Add zezeozue to OWNERS" am: f9972055f5
am: e8db702702

Change-Id: I0b6a7b06d1ce39e8e70e87a14b312425c55828d5
2019-11-15 08:32:59 -08:00
Zimuzo Ezeozue
e8db702702 Merge "Add zezeozue to OWNERS"
am: f9972055f5

Change-Id: I45c211d810f1a15e0b5a1f4decc33a0eece8dafd
2019-11-15 08:25:56 -08:00
Zimuzo Ezeozue
f9972055f5 Merge "Add zezeozue to OWNERS" 2019-11-15 16:06:59 +00:00
Zim
076967a823 Add zezeozue to OWNERS
Test: n/a
Change-Id: I75339fcea5d4e537c6312e8e515b6dd62d7ae7fc
2019-11-15 16:03:47 +00:00
Zim
e5393d437c Fix wrong symlink terminology
symlink(2) creates a symbolic link 'linkpath' containing a
string 'target'.

linkpath was misnamed as target in MountUserFuse. This cl
s/target/linkpath/ in Utils#MountUserFuse.

Test: m
Change-Id: I274823da16b87ffc124e2e8c4563b1d16546a6e7
2019-11-15 11:44:12 +00:00
Zim
2d45d9b420 Fix emulated volumes not created for secondary users
Ifabaa12368e5a591fbcdce4ee71c83ff35fdac6b introduced individual
emulated volumes for each Android user. The change however didn't
create the volumes for the secondary users on user start in vold
without the persist.sys.fuse flag

Now we always create the volumes but only mount sdcardfs volumes
for user 0 because the sdcardfs mount paths do not change with for
different users unlike the FUSE mount paths.

Bug: 144473552
Test: atest AdoptableHostTest
Test: Start a guest user in Settings and launch chrome browser in that
user, verify that chrome does not crash

Change-Id: I89f3591d0197d86267f0e3934f496273e2f9fd7e
2019-11-14 16:28:33 +00:00
Zim
a438b24368 Fix multi-user and multi-storage with FUSE
Up until now, the FUSE mount logic has made two assumptions:
1. The primary external volume is an emulated volume on /data/media
2. Only the primary user is running, as user zero

These assumptions are fixed by the following changes
creating an EmulatedVolume per Android user and changing the
VolumeBase id format to append the user to the id, so
s/emulated/emulated-0/. This allows us mount separate volumes per user

Some additional refactorings to re-use/clean up code.

Test: adb shell sm set-virtual-disk and partition disk operations work
even after setting up a work profile
Bug: 135341433

Change-Id: Ifabaa12368e5a591fbcdce4ee71c83ff35fdac6b
2019-11-11 20:24:49 +00:00
shaozhongqi
0ddfc941b8 Merge "Exfat Need to add automatic repair function when exfat fsck device" am: 7e249ebdae am: 8006c80960
am: 42726be6a3

Change-Id: Ic8f3d783087dde9550230e36749eab49b30d9fdc
2019-11-08 15:26:27 -08:00