1. Use bigger buffer for transfers - 64kb is the default size
for push, so let it be the same in streaming
2. Use abb when it's available for lower overhead
3. Add a posix_fadvise() on the source APK
4. Increase buffer sizes for the socketpair that's transferring
the data from adbd.
Overall this saves about 25% time for streaming installations
and makes it faster than the legacy push (at last!)
Test: manual
Change-Id: Ieb84284da2058944815e062ef6e4389b842565fa
Check for A/B /dev/block/by-name/system<slot> and also non-A/B
/dev/block/by-name/system to discover what /dev/root can be when
evaluating candidates for using overlayfs.
This is to handle a misconfigured (or legacy) system-as-root device.
It is recommended that the default fstab specifically mentions the
root mount's device node to prevent going down this path.
Test: adb-remount-test.sh
Bug: 138407617
Change-Id: I3853d203b9376d0f848cb490150ff00cc4ed3d5f
This implements InitiateMerge() and WaitForMerge(). InitiateMerge() is
meant to be called after an update has been marked successful.
WaitForMerge() is designed to be called either: immediately after
InitiateMerge, or during each subsequent boot where merging has not
completed.
InitiateMerge converts each snapshot device to a snapshot-merge device.
WaitForMerge polls each snapshot-merge device until no device reports a
"merging" state. One of the following states can result from this:
- MergeFailed. This will happen if any device failed to merge, or we
were unable to poll, or any other system-level failure occurred.
- MergeNeedsReboot. This will happen if a snapshot-merge device has
completed merging, but we were unable to clean it up due to something
holding a resource open.
- MergeCompleted. This indicates that all snapshots completed merging
and were cleaned up.
If WaitForMerge() returns MergeCompleted, then all snapshots have been
removed and a new update can begin. GetUpdateState() will return None.
MergeFailed and MergeNeedsReboot, on the other hand, are "sticky". They
indicate a merge is still pending. When called again, WaitForMerge()
will poll again to attempt to make more progress in the merge. For
NeedsReboot, a single reboot will ensure all resources are released and
the next WaitForMerge() will successfully finish cleanup. In the failure
case, it is unlikely the next WaitForMerge will succeed, but we always
retry anyway (there is no harm in doing so, and if we get lucky, the
device can take more OTAs).
Bug: 136678799
Test: libsnapshot_test gtests
Change-Id: I5e93fcbffee1973da5ff76363df12d6317a7a7c7
When we stopped unmapping snapshots in DeleteSnapshot, this also stopped
unmapping the COW device. Of course, the caller has no way to unmap this
since it's an implementation detail. Therefore unmap it in
DeleteSnapshot.
This scenario can arise after rewriting or removing a snapshot-merge
device.
Bug: 136678799
Test: manual test
Change-Id: I9d4c8bcfbb95b4454edd1cf0853d51b441e895fa
Per-snapshot locks don't solve any problems and add a great deal of
complexity. Instead, refactor the Read/WriteSnapshotStatus methods so
the caller just needs the snapshot name, and is not responsible for
opening a file.
As part of this change, callers of WriteSnapshotStatus must always take
an exclusive flock on the update state file. This is enforced by adding
a helper method to LockedFile to check the lock mode.
Bug: 136678799
Test: libsnapshot_test gtest
Change-Id: Icd580aaec7dfc916b3eed174d86b26688cd2291b
This CL fixes a bug where libsnapshot_test failed on the first run. It
also fixes bugs where it could not run if it died in the middle of a
test.
Previously, libsnapshot_test relied on CancelUpdate() to perform
cleanup, which cannot run in certain states. Instead, manually delete
dm devices and COW image files, and forcefully erase any lingering data.
Bug: 136678799
Test: libsnapshot_test gtest
Change-Id: I7b2399a403b387eb47184626e71dcf8674f6ab89
Move the logic for retrofit DAP to its new function. The new flow
in NewForUpdate is:
metadata = ReadMetadata();
if (retrofit dap) UpdateMetadataForOtherSuper(metadata)
return metadata;
Test: liblp_test_static
Change-Id: I6890fff3a7c44ebe2004de96b2ccbe1e8ce37546
* changes:
toolbox: add modprobe
libmodprobe: add verbose mode
libmodprobe: add GetAllDependencies
libmodprobe: add support to list modules
libmodprobe: add support for a blacklist
libmodprobe: support parameters in LoadWithAliases
libmodprobe: add support to remove modules
libmodprobe: make name canonical in LoadWithAliases
libmodprobe: make available in vendor
kDefaultGroup is the 'default' group that is never deleted
and has no size constraints. During a virtual a/b update,
the following series of action happens:
- move partitions out of groups that will be shrunk / deleted
(into default)
- shrink / delete these groups
- grow / add other groups
- move those partitions to their destination group.
Otherwise, the metadata is inconsistent.
Bug: 138816109
Test: builds
Change-Id: I57cf4b44dda948377c6b3153756f469caa4652bc
It is hard to re-use this function in the merge code when it forcefully
unmaps the snapshot, because the snapshot may have been rewritten to be
a dm-linear device. Instead, leave the decision up to the caller.
Bug: 136678799
Test: libsnapshot_test gtest
Change-Id: I03c027c0781696885a5a5654d3049287cc16ecd0
Use dependency injection so that GetProperty / GetBoolProperty
can be mocked in tests.
Test: run liblp_test_static
Change-Id: I8efa85fbbd7aebce2541f748f840e512f3729c30
Previously, we were calling acquire_one_transport with all empty
parameters, which would work when only one device is connected, but fail
when there are multiple. We've already acquired a transport and put it
into the socket as part of the forward request, so just use that
directly.
Bug: http://b/136198949
Test: test_device.py with multiple devices connected
Change-Id: I4d6bda45b36b71e418ecd9ead61b7379e68aa19b
Change its type from std::string to constexpr char[] so that it does
not need to be constructed at runtime, which pollutes the bss page
unnecessarily.
Bug: 138856262
Test: Along with another fix for libbootloader_message.so, see that bss
section for libbootloader_message.so is now clean on cuttlefish
for several processes.
Change-Id: I1c8ff9cfeb25164a352cef89cfa7be889b3d3387
Add support to specify module parameters in LoadWithAliases. These
parameters will be appended to any which are specified for the module in
modules.options.
Change-Id: I9aff1656ea397826f815b658b3b52c1892748601