Since there is no change in the buffer allocation
code with respect to snapshots in user-space, refactor
it so that we have a common code base.
Bug: 193863397
Test: Build
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I3a7b3d319f6d1532b1bb63af9884b64e1346bb50
Implement snapshot merge in the daemon. Following
are the important changes:
1: Spin up merge thread which does merging in user-space.
2: For ordered ops (COPY and XOR), read-ahead thread is used.
3: Read-ahead thread will read a fixed set of COW ops and cache
them in memory. Furthermore data is saved in scratch space buffer
in COW device.
4: No change in scratch space buffer - default 2MB buffer is allocated.
5: Merge thread and Read-ahead thread will work in lock step for merging
ordered ops.
6: Once the ordered ops are merged, REPLACE and XOR operations are
merged.
7: If there is a crash during merge, COW header tracks the number of
operations merged. No change in this code path.
8: Merge thread requires Base device for merging as opposed to using
the source device. Hence, while initializng the merge threads,
libsnapshot will have to pass the "Base" device to the daemon. This
is the same "Base" device which is passed to dm-snapshot during
snapshot creation.
Patch does not handle any communication with dm-user yet.
Bug: 193863397
Bug: 193863280
Bug: 193862712
Test: snapuserd_test on CF
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I14aab6eaa07ac68f2a3a23516ed9ba6567a35734
Move all the snapuserd files related to dm-snapshot/dm-snapshot-merge
to a seperate directory. We will have a logical seperation
to maintain user-space merge code.
No code changes other than moving files around.
Bug: 193863397
Test: Build
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ide0d824bb19f9d870ec32699d0a37de0e5d6ce81
This reverts commit 8d3b31fe68.
Reason for revert: With https://r.android.com/1840754, bionic will handle the real time signal for statically linked binaries.
Change-Id: I81f0892f1734c7ecfb604820a8894506df8618b3
Each VTS module is required to have OWNERS file. The ownership is based on
go/vts-owners. For more information about ownership policy, please visit
go/xts-owners-policy.
Test: Tree Hugger
Bug: 143903671
Change-Id: Id2911fd62841bf5622607f9deeb50c7cf1413b1b
Add a signal handler for real time signal 36 which
is primarily used by profilers. Default action is to
terminate the daemon if there is no signal handler. We
don't want daemon to get terminated, hence just capture
the signal and ignore it.
Bug: 201497662
Test: cow_snapuserd_test, pkill -36 snapuserd
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Ife5a8bdb7344956076bc4223c19a126b90a00706
It turns out update_engine never gets a ICowReader instance... it only
gets a generic FileDescriptor. So bring this function all the way up to
ISnapshotWriter interface.
Test: th
Change-Id: I7d17b9537f97282c99203b5cc13892e5daa1be4c
Test options for the api levels are moved to test_options.
test_min_api_level property will be removed with this change.
Bug: 187258404
Test: build
Change-Id: Id943566de2ac693b5955bd84a8463e5013a8bb0f
update_engine only sees ICowReader, so in order for update_engine to
consume this API, it has to be in the base interface class.
Test: th
Change-Id: I9100b6aa1db6eb6a884752620098172bdd51f200
This test uses dependency injection to cause a failure in
QuerySnapshotStatus. We expect ProcessUpdateState to return MergeFailed.
The test also checks that if the merge is attempted again, it can
succeed.
Some duplicated code has also been factored out into the test harness.
Bug: 198265278
Test: vts_libsnapshot_test gtest
Change-Id: I6ccb434afa0e5ebf6781b2cec5277e3b7c210b77
Userdata spaces leak when zram writeback is enable and repeatedly kill
system_server(restart android).
The reason is that per_boot‘s inode is hold by loop device
although per_boot is deleted by user which become orphan inode in system.
Adds LO_FLAGS_AUTOCLEAR for loop device of zram backing device,
so loop device can release resouce.
Bug: 200904398
Change-Id: Ifeee9c0b58b10cdf7698077fbcaf54d5faccc3b1
Signed-off-by: Liangcai Fan <liangcai.fan@unisoc.com>
Signed-off-by: Hongyu Jin <hongyu.jin@unisoc.com>
Signed-off-by: Jing Xia <jing.xia@unisoc.com>
This adds a function that verifies that the merge sequence does not
attempt to use blocks that have already been overwritten. It prints the
first such conflict to the logs.
Additionally, this adds a forwards merge iterator, and the ability to
ignore current progress in a merge for the purposes of verifying the
whole sequence.
This can be accessed via the VerifyMergeOps Function in Cow Reader, or
by using inspect_cow -v [COWFILE]
Include merged ops in inspect_cow listing with -a, and view ops in merge
order with -n
Bug: 200076590
Test: cow_api_test.InvalidMergeOrderTets
Change-Id: I893b9f8a8803cb6dd53225ec34224167b9fe2fda
It is difficult to test libsnapshot failures because there is no way to
inject failure scenarios into the kernel's device-mapper. Exposing a
virtual interface will allow this kind of testing via dependency
injection.
Bug: 199785546
Test: builds, tests pass
Change-Id: I5add0c7e24f7fa2853114eaeda7c479eaa4e0552
Added Android-Apache-2.0 to fs_mgr/libsnapshot/scripts/Android.bp
Bug: 68860345
Bug: 151177513
Bug: 151953481
Test: m all
Change-Id: If966409962d564c1cfec901af2f2b78e891b7fca
QuerySnapshotStatus will capture the error codes
from dm-snapshot if there are any snapshot related
failure. Handle the error codes and fail the
QuerySnapshotStatus call.
Validate snapshot status in MapSnapshot(). If
the mode is set to Persistent and snapshot status
is in Merging state, then forcefully set the
mode to Merge state.
Bug: 198265278
Test: Full/incremental OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I779184f1998b23edacd6e780acf2676442004340
If there is an I/O request which doesn't map to any
COW Operation in the vector mapping, then that request
is an EOF request and should not be discarded with an
I/O error.
Bug: 198787355
Test: Incremental OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I241ee11d7cf540854aa4a232bc1b18da43d41e05
It has some random errors on the cloud, so skpping them for now.
Bug: 187303962
Test: atest --host \
libfs_avb_internal_test:libfs_avb_internal_test.AvbUtilTest#VerifyVBMetaDataError
Change-Id: I658e3f052f99af645bdd44087f519d58acbe5641
When checking the instead of current, and when checking the position, we could underflow,
which would get caught by UBSAN
Bug: 177104308
Test: Map cow file with xor op or copy op at position 0
Change-Id: I4fba1982419e08b58759ec893e238175d245dbfc
It's requested by the partner engineering team to uniquely
identify a partition.
Bug: 197973981
Test: boot the device and check props
Change-Id: I0f7aa34dd0087f0698fe90b9df6c0eae06fc4f5d
Bug: http://b/197965342
remount depends on libbinder.so which already depends on libutils.so.
When linking remount with libutils.a, the linker tries to fetch objects
from libutils.a to redefine undefined symbols in libbinder.so. This
causes linker failure with upstream LLD. Switching to shared
libutils.so instead doesn't increase the dependency closure for remount.
Test: build with aosp/1809741 which has lld with the above behavior.
Change-Id: I858042a08babe2c2db1fc8c7eeb5de62dda5f328
This makes inspect_cow not list all ops by default. Instead you must
pass -l to do this. This allows for viewing other data without being
overwhelmed bt the cow listings.
Test: inspect_cow with no flags, -l, and -lo
Change-Id: I3968ff53acb4e645a16ac5b09c5dee8374946f55
This allows inspecting sequence op data while viewing cow ops. Data will
be displayed per op.
Test: inspect_cow -o [CowFile]
Change-Id: I0029838ddc265c1aaeba2bbfa70241dea0b8ff20
When adding a new partition, don't attempt to map a source partition
during boot, because none exists. Instead use the base device.
Bug: 196922070
Test: vts_libsnapshot_test
Change-Id: Ice6015237b0a76a0210819994433e52159376393
A lot of things had moved out of system/core/ without their TEST_MAPPING
entries having gone with them, reducing the amount of presubmit coverage
for those things.
In order to reduce the likelihood of that happening again, I've pushed
all that remained in the system/core/ TEST_MAPPING down into the
individual subdirectories.
Test: treehugger
Change-Id: Ib75d65f9200fa64ae1552471da6fbe5b7023cf94