Commit graph

11 commits

Author SHA1 Message Date
Jeff Sharkey
46bb69f49a Progress towards FBE and adoptable storage.
Offer to adopt storage devices on FBE devices, but keep it guarded
behind a system property for now, since we still need to work out key
storage details.

When migrating shared storage, leave user-specific /data/media
directories in place, since they already have the needed crypto
policies defined.

Enable journaling, quotas, and encrypt options when formatting
newly adopted devices.  installd already gracefully handles older
partitions without quota enabled.

Test: cts-tradefed run commandAndExit cts-dev --abi armeabi-v7a -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest
Bug: 62290006, 36757864, 29117062, 37395736
Bug: 29923055, 25861755, 30230655, 37436961
Change-Id: Ibbeb6ec9db2394a279bbac221a2b20711d65494e
2017-06-26 09:53:10 -06:00
Jeff Sharkey
a0220a5bd4 Abort migration early when not enough space.
Otherwise we potentially waste minutes of the users time copying
data that will never fit.

Also fix bug around storage calculation.  It's confusing, but f_bsize
is not the value you're looking for; the real block size is f_frsize.

Test: builds, boots
Bug: 27590986, 36840579
Change-Id: I77c63e259356824cc75a3adcf3f4af567efdc7aa
2017-04-03 17:13:06 -06:00
Jeff Sharkey
fce701b5f1 Blocking mode for debugging purposes.
The default non-blocking mode doesn't log stdout/err from the
commands exec'ed during a move.

Bug: 29923055
Change-Id: I9de3fe9bfcfa3c1d39a32ecc89dd765202460376
2016-08-10 17:41:19 +00:00
Henrik Baard
1bc5ab0c4d Failing to \"Migrate data\" leaves target unusable
am: 77f156d9f0

Change-Id: I56e313c68a35fbb67c0ad9d53f08fa24e4e8e742
2016-07-07 01:35:42 +00:00
Henrik Baard
78c63c26a7 Migrating data sometimes leaves emulated unmounted
am: 7f52bca485

Change-Id: Id45c7edab0d244dcb17d6bda491ca297ed55c1c0
2016-07-07 01:35:41 +00:00
Henrik Baard
77f156d9f0 Failing to "Migrate data" leaves target unusable
When "migrating" data failes due to insufficient space
at target location, the data copied so far is left in
target location, which in practice is now filled to the
brim.

If copy fails clean up the data copied so far since user
has the data in original location.

Bug: 26322200
Change-Id: Iab29a7f9e653e6857ee0e2723d151dfec81b14dd
2016-07-06 15:42:41 -06:00
Henrik Baard
7f52bca485 Migrating data sometimes leaves emulated unmounted
Sometimes migrating data fails to mount the target
volume after operation is finished.

MoveTask is running in its own thread, copying data
between external card and internal memory.

After copying the data the method "bringOnline" is
run. This method destroys and creates the volumes.

When VolumeBase::create() is run it will notify
MountService, who upon receiving this notification
will send a mount command to mount the new primary
storage.

This command will sometimes run before
setState(State::kUnmounted); is called on the newly
created volume. This will cause the mount command to
fail.

VoldConnector: SND -> {10 volume mount emulated 3 -1}
vold : emulated flags change requires state unmounted or unmountable
vold : emulated user change requires state unmounted or unmountable
vold : emulated mount requires state unmounted or unmountable

Lock bringOnline so no volume commands will be processed
until volumes are (re-)created and have correct state.

Bug: 26322200
Change-Id: I4aba85c226d904c42ae9edcdfec21619218939d6
2016-07-06 15:42:34 -06:00
Chih-Hung Hsieh
cc5d580858 Fix misc-macro-parentheses warnings.
Add parentheses around macro arguments used beside binary operators.

Bug: 28705665
Change-Id: I0731cb8b22b3a9bdadac6414473d90e8398a8e89
2016-05-11 15:05:05 -07:00
Elliott Hughes
7e128fbe21 Track rename from base/ to android-base/.
Change-Id: I3096cfa50afa395d8e9a8043ab69c1e390f86ccb
2015-12-04 15:50:53 -08:00
Jeff Sharkey
c86ab6f538 Trim both internal and adopted private storage.
Refactor fstrim code to be encapsulated in unique task object, and
give it option of benchmarking when finished.  Trimming now includes
both storage from fstab and adopted private volumes.  Cleaner timing
stats are logged for each unique volume.

Add wakelock during ongoing async move tasks.  Push disk sysfs path
to framework so it can parse any SD card registers as desired.

Bug: 21831325
Change-Id: I76577685f5cae4929c251ad314ffdaeb5eb1c8bf
2015-07-01 15:53:51 -07:00
Jeff Sharkey
1d6fbcc389 Migrate primary external storage.
When requested, kick off a thread that will migrate storage contents
between two locations.  This is performed in several steps that
also interact with the framework:

1. Take old and new volumes offline during migration
2. Wipe new location clean (10% of progress)
3. Copy files from old to new (60% of progress)
4. Inform framework that move was successful so it can persist
5. Wipe old location clean (15% of progress)

Derives a hacky progress estimate by using a rough proxy of free
disk space changes while a cp/rm is taking place.

Add new internal path for direct access to volumes to bypass any
FUSE emulation overhead, and send it to framework.  Remove mutex
around various exec calls since setexeccon() is already per-thread.

Bug: 19993667
Change-Id: Ibcb4f6fe0126d05b2365f316f53e71dc3e79a2b8
2015-04-24 16:08:07 -07:00