Commit graph

1966 commits

Author SHA1 Message Date
Yifan Hong
5b182952de Merge "Handle zero snapshot size appropriately." into rvc-dev 2020-05-02 04:47:00 +00:00
Yifan Hong
c2a048e2ed Handle zero snapshot size appropriately.
This won't happen in practice because device size is never
zero. Hypothetically, if it is, PartitionCowCreator still
suggests that a CoW size of 8192 bytes needs to be created. In
reality, it is not necessary.

Test: libsnapshot_fuzzer
Bug: 155484992
Change-Id: I6c69f54820522d50c699384eec90c474ca3a9402
(cherry picked from commit bc84824e21acfdc83590d6d0d4827bd9854fc0f5)
Merged-In: I6c69f54820522d50c699384eec90c474ca3a9402
2020-05-01 11:52:01 -07:00
David Anderson
0d246eb96a Merge "libfiemap: Ignore userdata requirements in fiemap_writer_test when running a DSU." into rvc-dev 2020-05-01 17:46:02 +00:00
Alessio Balsini
2612f9b116 snapshot_test: Fix overflow in statvfs arithmetics
Operations on (unsigned long) f_bsize and f_bfree are correctly handled
on 64 bit architectures, but when switching to 32 bit, the
multiplication between the two could result in an overflow, causing the
test to crash.
Fix by using a uint64_t operand, hinting the compiler to handle the
whole multiplication with 64 bit operands.

Bug: 154355449
Bug: 148889015
Test: vts_libsnapshot_test (32 bit)
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: Ief5c03ff7954c4a3e8597ef6e7df467f59428877
Merged-In: Ief5c03ff7954c4a3e8597ef6e7df467f59428877
2020-05-01 12:21:08 +01:00
TreeHugger Robot
1e8f30f919 Merge "Moves some shared_libs to static_libs for vts_libsnapshot_test." into rvc-dev 2020-04-28 23:14:33 +00:00
David Anderson
6e8ae6d2b2 libfiemap: Ignore userdata requirements in fiemap_writer_test when running a DSU.
The test is guaranteed to fail because userdata is itself a fiemap-backed device.

Bug: 154447105
Test: fiemap_writer_test on DSU
Change-Id: Ied35da0eb7aba3daca7ed430f006bf1e90e21dca
Merged-In: Ied35da0eb7aba3daca7ed430f006bf1e90e21dca
2020-04-28 15:28:39 -07:00
Daniel Norman
f1d37369ed Moves some shared_libs to static_libs for vts_libsnapshot_test.
These shared_libs are missing from /system/lib/ on 64-bit devices.

Test: Build, install, and run 32bit vts_libsnapshot_test.
Bug: 154115505
Change-Id: Iaf2014748546a055d35e4fe0e24969eef13db7fa
2020-04-27 15:40:38 -07:00
TreeHugger Robot
19685064b9 Merge "Convert vts configs to Android.bp" into rvc-dev 2020-04-27 17:05:10 +00:00
Automerger Merge Worker
cb02c1f825 Convert vts configs to Android.bp
Bug: 154727600
Test: treehugger
Change-Id: Ibe8ed03555ac78ee38be6511eb4169cddfcd3555
Merged-In: Ibe8ed03555ac78ee38be6511eb4169cddfcd3555
2020-04-27 16:36:53 +00:00
David Anderson
f81ec0e43a liblp: Fix tests for linear extent overlap.
The "OwnsSector" tests did not work if one range fit completely inside
another range. The new OverlapsWith() methods address this case.

Bug: 154277287
Bug: 154646936
Test: liblp_test gtests
Change-Id: I1a59069db4ffe4f13c45963c4847cff7b3dd3dfc
2020-04-22 14:39:04 -07:00
Nikita Ioffe
f42f972130 Merge "PrepareZramBackingDevice: use loop_control.h" into rvc-dev 2020-04-20 20:06:16 +00:00
Nikita Ioffe
c8313adf88 PrepareZramBackingDevice: use loop_control.h
loop_control.h already provides loop device management APIs that we need
here. In addition, this change fixes a subtle race condition between
uevented creating a loop device node in userspace and
PrepareZramBackingDevice accessing it without waiting for it to be
created.

Test: device boots
Test: adb reboot userspace
Bug: 154500256
Change-Id: If80f18c8c337210030a6caf2aec6f7a47472b6fb
2020-04-20 17:38:17 +01:00
Alessio Balsini
75be098a45 Fix liblp imported both as static and dynamic lib
In vts_libsnapshot_test, liblp was explicitly imported as static
library, but due to the importing of libsnapshot_defaults, it also
inherited the shared importing.
The import in libsnapshot_default, is not required, drop it.

Test: manual inspection with ldd
Bug: 148889015
Signed-off-by: Alessio Balsini <balsini@google.com>
Change-Id: I12ba0516a482dc917848b5f34cccc659a60a4803
Merged-in: I12ba0516a482dc917848b5f34cccc659a60a4803
2020-04-20 14:54:23 +01:00
Martijn Coenen
884c64a052 Merge "Rename external storage properties." into rvc-dev 2020-04-17 07:59:26 +00:00
Martijn Coenen
590969d140 Rename external storage properties.
According to property naming guidelines.

Bug: 152170470
Bug: 153525566
Test: N/A
Change-Id: Ia5ce2a95e43724f8d0a7abf6782bc177dedb18a8
Merged-In: Ia5ce2a95e43724f8d0a7abf6782bc177dedb18a8
2020-04-16 10:13:28 +02:00
David Anderson
a632c0c470 fs_mgr: Fix executable path in clean_scratch_files.
Bug: 154071877
Test: no error log on startup
Change-Id: I84c627011992eed6952697e7260051006b1c10d0
Merged-In: I84c627011992eed6952697e7260051006b1c10d0
2020-04-15 21:27:56 +00:00
TreeHugger Robot
1dc77eaa61 Merge "Abolish DmTargetDefaultKey::IsLegacy" into rvc-dev 2020-04-08 00:10:58 +00:00
Paul Crowley
c9c9d1288f Abolish DmTargetDefaultKey::IsLegacy
To make it easier to support disk formats created using old versions
of dm-default-key with new kernels, stop checking the kernel module
version; instead, the caller decides whether to use the old or new
options format.

Bug: 150761030
Test: crosshatch and cuttlefish boot normally; cuttlefish
    fails with "default-key: Not enough arguments" as expected when
    option is set to 1
Cherry-Picked-From: 539b98fb58
Merged-In: I810bb7e085b9b8648858de1a02165162d1fd163e
Change-Id: I810bb7e085b9b8648858de1a02165162d1fd163e
2020-04-07 07:33:05 -07:00
Nikita Ioffe
7facdac6af get_mounted_entry_for_userdata: Realpath block devices from fstabs
Use realpath as a canonical representation of block devices. This makes
it easier to reason about block devices. This also fixes a bug, in which
fs_mgr_get_mounted_entry_for_userdata didn't properly work on devices
that don't support metadata encryption.

Test: atest CtsFsMgrTestCases
Test: atest CtsUserspaceRebootHostSideTestCases
Bug: 153363818
Change-Id: I139c2be46336a632bbaee86667019c075d7de814
Merged-In: I139c2be46336a632bbaee86667019c075d7de814
(cherry picked from commit 7aa37f1f21)
2020-04-07 14:04:06 +01:00
Dan Shi
783db0d261 Merge "Rename vts-core to vts" into rvc-dev 2020-04-07 02:48:30 +00:00
TreeHugger Robot
ffe8c3a110 Merge "Remove vts10 tests from vts suite" into rvc-dev 2020-04-07 00:19:39 +00:00
Dan Shi
a7b9a2bfd2 Rename vts-core to vts
Bug: 151896491
Test: presubmit check
Exempt-From-Owner-Approval: This CL renames suite name vts-core to vts.
It won't change test logic or behavior.

Change-Id: I24779951257ce37fc18929f214d3cf5f76c23a19
2020-04-06 16:11:29 -07:00
Dan Shi
12c7aa8ace Remove vts10 tests from vts suite
The tests are only needed in vts10 suite, as they are part of CTS
package and no longer needed in vts 11.

Bug: 151896491
Test: local build
Exempt-From-Owner-Approval: This CL removes vts10 tests from vts suite.
It won't change test logic or behavior.

Change-Id: I4d468be075b54213b56c7e1aa94af94f2bdce9ff
Merged-In: I4d468be075b54213b56c7e1aa94af94f2bdce9ff
2020-04-06 14:25:10 -07:00
Yifan Hong
e94892a92e Merge "libsnapshot: Add VTS10 VtsLibsnapshotTest" into rvc-dev 2020-04-06 19:02:05 +00:00
Yifan Hong
6e285ae4a7 libsnapshot: Add VTS10 VtsLibsnapshotTest
Add VTS10 variant of vts_libsnapshot_test so that
it can be added to vts-kernel test.

Bug: 142513589

Test: vts10-tradefed run vts-kernel -m VtsLibnsapshotTest
Change-Id: I4e2516b94d84acb16f595aab87dd3c0cadad6166
(cherry picked from commit 405da5a9a6)
Merged-In: I4e2516b94d84acb16f595aab87dd3c0cadad6166
2020-04-03 16:38:39 -07:00
Bill Peckham
59f0acc146 Ignore functionfs mounts.
Vendors may add additional functionfs mounts. Since these
will never be remounted, we can safely filter these out.

Bug: 153008210
Test: Test device with previously unfiltered entries.
Change-Id: I7f384b8a0ce93dd6701fe3c4d9dd2557370b31e1
Merged-In: I7f384b8a0ce93dd6701fe3c4d9dd2557370b31e1
2020-04-03 12:10:46 -07:00
David Anderson
15e63dff21 libdm: Link libraries statically for VTS.
Bug: 152180548
Test: 32-bit libdm_test
Change-Id: I9f356c854833b5e68820e4d3d4e9709af1288381
Merged-In: I9f356c854833b5e68820e4d3d4e9709af1288381
2020-03-31 13:00:03 -07:00
Yifan Hong
47c08de2d2 libsnapshot: Allow forward merge on FDR
If forward merge indicator exists at unverified state during FDR,
we are allowed to initiate merge and finish it before wiping userdata.

Test: downgrades
Test: update with data wipe
Test: vts_libsnapshot_test
Bug: 152094219
Change-Id: I151f1af4aca446cc52e669c5c3ea2b2e55acb468
(cherry picked from commit 973b8c10d1)
Merged-In: I151f1af4aca446cc52e669c5c3ea2b2e55acb468
2020-03-27 16:11:08 -07:00
Yifan Hong
c7c7a21d2e libsnapshot: Place forward merge indicator for wipe
If the device applies a package with FDR, place forward merge indicator
so that on FDR, the snapshots aren't abandoned, and we forward merge
the update.

Test: apply downgrade
Test: apply update with data wipe
Test: vts_libsnapshot_test
Bug: 152094219
Change-Id: Id32aeca380db797cd777321837f146333ae6b33c
(cherry picked from commit 6b0251232a)
Merged-In: Id32aeca380db797cd777321837f146333ae6b33c
2020-03-27 16:11:08 -07:00
Yifan Hong
1cc4ce96ce libsnapshot: Add allow-forward-merge indicator.
The indicator signals that on factory data reset, initiating
merge is allowed.

Test: vts_libsnapshot_test
Test: apply downgrade update
Test: apply update with FDR
Bug: 152094219
Change-Id: Ieecddd198136571dd652ca62c27fe65a12b7b15f
(cherry picked from commit f9e1e16377)
Merged-In: Ieecddd198136571dd652ca62c27fe65a12b7b15f
2020-03-27 16:11:08 -07:00
Yifan Hong
d5c899e46a libsnapshot: Fix DataWipeAfterRollback test
Test: run it
Bug: 152094219
Change-Id: I06852d7a0514481cbeed3ef66192ba49a24cb54b
(cherry picked from commit a4f9b07490)
Merged-In: I06852d7a0514481cbeed3ef66192ba49a24cb54b
2020-03-27 16:11:07 -07:00
David Anderson
3c4b379cb0 libsnapshot: Fix intermittent test failure due to missing null check.
Bug: 152547190
Test: vts_snapshot_test
Change-Id: If7adc4fba61325e52d6268531ce0a15b00c0a380
(cherry picked from commit 533b2b6296)
Merged-In: If7adc4fba61325e52d6268531ce0a15b00c0a380
2020-03-27 16:11:07 -07:00
Yifan Hong
37f5bb9faa libsnapshot: dump rollback indicator
Test: snapshotctl dump
Bug: 149956852
Change-Id: Ib0308ab75d6dce4047b46d06cece95eed23620a9
(cherry picked from commit 738a94b798)
Merged-In: Ib0308ab75d6dce4047b46d06cece95eed23620a9
2020-03-27 16:11:07 -07:00
Nikita Ioffe
f0ab5b17f6 Use properties for various userspace reboot timeouts
Test: adb reboot userspace
Bug: 146560409
Change-Id: I435e4f93a8769ff7d30cf781e0b48fa3e96121ef
Merged-In: I435e4f93a8769ff7d30cf781e0b48fa3e96121ef
(cherry picked from commit 7b41a1558d)
2020-03-25 21:40:45 +00:00
Yifan Hong
c04d4a567c libsnapshot: Add RecoveryCreateSnapshotDevices(device)
... that doesn't auto mount/umount /metadata.

Test: builds
Bug: 151983957
Change-Id: If525a82c1635ddef221e7be20763bc2f27d3c417
Merged-In: If525a82c1635ddef221e7be20763bc2f27d3c417
2020-03-20 17:55:09 -07:00
PO HUNG CHEN
e3a22ca19d Merge "Convert gsid to use the dynamic AIDL service infrastructure" into rvc-dev 2020-03-16 06:56:16 +00:00
Daniel Rosenberg
7c59f1ae9d Set GC threshold when mounting with checkpointing
This steps up our garbage collection threshold over time when mounting
userdata with checkpointing=disable for f2fs. With this scheme, we step
up the percent of disk we will tolerate being unusable during
checkpointing. At 100%, the filesystem will be able to always mount.
This means we will attempt to mount at most 10 times, for a max time of
about 50 seconds.

Also logs mount time under ro.boottime.init.mount.[target]

If the device does not support checkpoint=disable:[n%], it will mount
with checkpoint=disable, which is equivalent to checkpoint=disable:0%

Test: Boot in checkpointing mode
Bug: 150506496
Change-Id: I047ff98513f4ea832e1216b91e454a57fd2e8bf6
2020-03-13 20:12:02 +00:00
Yifan Hong
5bcf6498c3 Merge "Add OptimizeSourceCopyOperation" into rvc-dev 2020-03-12 23:53:03 +00:00
Yifan Hong
d8a38e7c23 Add OptimizeSourceCopyOperation
... so that an operation can be skipped partially. For example, if
an operation contains blocks:
    563412 -> 123456
... then optimized operation is:
    5612 -> 1256

Test: update_engine_unittests
Test: apply incremental OTA
Bug: 148623880

In an experiment, this reduces CoW size of an incremental update
package by 200MB (out of 700MB).

Change-Id: I86ca23fd589ddbc84c81318283b5f4e71782a759
Merged-In: I86ca23fd589ddbc84c81318283b5f4e71782a759
2020-03-12 10:00:12 -07:00
Nikita Ioffe
ccb0608a32 Merge "fs_mgr_get_mounted_entry_for_userdata: handle logical partitions" into rvc-dev 2020-03-11 19:17:30 +00:00
Nikita Ioffe
f495fe798b fs_mgr_get_mounted_entry_for_userdata: handle logical partitions
In case of GSI on DSU, /data is mounted on the following stack:
userdata -> userdata_gsi -> actual block device, and fstab returned from
ReadDefaultFstab() function will say that /data should be
mounted onto userdata_gsi. This configuration wasn't supported.

To support it, fs_mgr_get_mounted_entry_for_userdata now unwinds the
dm-device stack /data is mounted onto, and for each entry in fstab
resolves corresponding block device (in case of logical partitions by
asking DeviceMapper to resolve name -> path, and for other cases by
reading a symlink), and then checking whenever resolved block device
belongs to the unwinded stack.

Test: on both normal boot & DSU
Test: atest CtsUserspaceRebootHostSideTestCases
Test: atest CtsFsMgrTestCases
Bug: 148612148
Change-Id: I1bb3e64ae92d56de905b4f7f1997b7499b101b0f
2020-03-11 15:10:20 +00:00
Yifan Hong
77d51eb888 Merge changes from topic "no_snapshot_callstack" into rvc-dev
* changes:
  Revert "libsnapshot::RemoveAllUpdateState log stack"
  Revert "libsnapshot callstack files readable by dumpstate"
  libsnapshot: delete InitiateMergeAndWait.
2020-03-10 19:18:48 +00:00
Howard Chen
c7e257c1e9 Convert gsid to use the dynamic AIDL service infrastructure
Replace the original on demand start mechanism with the new dynamic
AIDL service infrastructure to resolve a possible race condition.

Bug: 149130673
Test: gsi_tool status

Merged-In: Ia5f32579a8dcf62d700d974c7f4e3c65647f3b8b
Change-Id: Ia5f32579a8dcf62d700d974c7f4e3c65647f3b8b
2020-03-10 17:35:41 +08:00
Yifan Hong
21ab3adc73 Revert "libsnapshot::RemoveAllUpdateState log stack"
Revert submission snapshotctl_callstack

Reason for revert: Callstack should not be logged
Reverted Changes:
Ib80c74a9a:Temporarily add libutilscallstack dependency
I2dfb6b7f1:libsnapshot::RemoveAllUpdateState log stack

Test: none
Bug: 148818798

Change-Id: I34683e93f10971629737f6fe648b25c6066c702f
2020-03-09 16:16:33 -07:00
Yifan Hong
611c6f7d79 Revert "libsnapshot callstack files readable by dumpstate"
This reverts commit faa49d1d00.

Reason for revert: Callstack should not be logged.

Test: none
Bug: 148818798

Change-Id: Ie5506ae0c7408e255a464b2f403d0a47d272229e
2020-03-09 16:16:33 -07:00
Yifan Hong
ffd1f52c22 libsnapshot: delete InitiateMergeAndWait.
Now that update_engine is responsible for initiating the
merge, InitiateMergeAndWait function becomes useless.

Bug: 147696014
Test: libsnapshot_test
Change-Id: I5473dc543ca8ac2fd31f597720847b02d0e5e33d
2020-03-09 16:16:33 -07:00
David Anderson
114a86ebb4 Merge "libdm: Fix WaitForFile early-returning on failed accesses." into rvc-dev 2020-03-09 19:08:43 +00:00
Nikita Ioffe
bbbd1a8e41 Merge "Move GetMountedEntryForUserdata to fs_mgr.h" into rvc-dev 2020-03-06 19:45:54 +00:00
Nikita Ioffe
8f50cfc28d Move GetMountedEntryForUserdata to fs_mgr.h
Logic of unwinding dm-device stack to figure out what entry was used to
mount userdata turned out to be a little bit more involved, and it
shouldn't be part of libfstab

This CL just moves code around and cleans API a little bit, actual fix
will be in the follow-up CL.

Test: atest CtsFsMgrTest
Test: atest CtsUserspaceRebootHostSideTestCases
Bug: 148612148
Change-Id: If0f8a765dba63adb0e6a711eb81fffdcabea3480
2020-03-06 18:31:38 +00:00
Yifan Hong
dd4e7ef6ce init: restorecon libsnapshot rollback indicator
The rollback indicator is created during first stage init and
is unlabeled. Need to restorecon it properly so that it can
be properly deleted by update_engine later.

Bug: 149956852
Bug: 150907679
Test: apply OTA, reboot, look at serial console
Change-Id: Ie954023b557865691fec2ae378145596bf1973a9
2020-03-05 21:56:03 -08:00