Commit Graph

2695 Commits

Author SHA1 Message Date
Akilesh Kailash 4375229588 snapuserd: Address alignment fault on 32-bit systems
When the scratch space is mmap'ed, the metadata buffer
will be un-aligned. This may lead to alignment fault
on 32-bit systems. Address this by temporarily copying
it to buffer.

No perf impact as this code path is not in I/O path
and the copy is a for the size of metadata buffer which
is 8k.

Bug: 206426215
Test: Full and Incremental OTA on pixel
1: Compile snapuserd as 32 bit and reproduced the bug on pixel.
2: With fix - OTA applied successfully.
3: Reboot the device when merge was in-flight as the fix is primarily
in that path.
4: Verify merge completion and data integrity post merge.

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Icd4a21d6a61f1ab36e65994c06a4d049a2ee741c
Merged-In: I63c0d862057ebf138c9d1696a942030e30598739
2021-12-01 20:37:56 +00:00
Akilesh Kailash c9a4c17a1a Merge changes I779184f1,I241ee11d into sc-qpr1-dev am: d6383199e8
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15825056

Change-Id: I1eb2a86623258bf10081f908bfc3b6187b244e93
2021-09-17 18:33:14 +00:00
Akilesh Kailash b6e9ccea8b snapuserd: I/O request on sectors not mapping to any COW op am: f7185915be
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15825055

Change-Id: I329f41ed268bfcec88a024846e38223511b9b263
2021-09-17 18:33:14 +00:00
Akilesh Kailash d6383199e8 Merge changes I779184f1,I241ee11d into sc-qpr1-dev
* changes:
  libsnapshot: Error handling after QuerySnapshotStatus
  snapuserd: I/O request on sectors not mapping to any COW op
2021-09-17 18:17:51 +00:00
Akilesh Kailash ab12b4e8ff libsnapshot: Error handling after QuerySnapshotStatus
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
Merged-In: I779184f1998b23edacd6e780acf2676442004340
2021-09-17 18:16:20 +00:00
Akilesh Kailash f7185915be snapuserd: I/O request on sectors not mapping to any COW op
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
Merged-In: I241ee11d7cf540854aa4a232bc1b18da43d41e05
2021-09-17 18:14:42 +00:00
David Anderson 5e9708644c libsnapshot: Fix new partitions not transitioning in second-stage init. am: 5932ed07db
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15832178

Change-Id: Icb3f865e7420772c45167d3d0d33f42b6cadb121
2021-09-15 23:30:22 +00:00
David Anderson 5932ed07db libsnapshot: Fix new partitions not transitioning in second-stage init.
Bug: 196922070
Test: vts_libsnapshot_test
Merged-In: If8a7afde218fd719e4426dc1dda41f53a4e6544b
Change-Id: If8a7afde218fd719e4426dc1dda41f53a4e6544b
2021-09-15 00:43:20 +00:00
David Anderson 05fbdcd3eb libsnapshot: Fix missing source partitions when adding a new partition. am: 0a6f250242
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15670247

Change-Id: Ieda77c5fc8cf867cb62054e0a38321fdf528e311
2021-08-27 19:36:47 +00:00
David Anderson 0a6f250242 libsnapshot: Fix missing source partitions when adding a new partition.
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
Merged-In: Ice6015237b0a76a0210819994433e52159376393
2021-08-25 00:02:39 +00:00
Bart Van Assche f54487b6c3 Reduce the queue depth of loop devices used by the zram driver am: 1a9cad816d am: d5a663fde4
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15584614

Change-Id: I268f8e7799c66accbd293e7d331175eeff933872
2021-08-18 20:18:41 +00:00
Bart Van Assche d5a663fde4 Reduce the queue depth of loop devices used by the zram driver am: 1a9cad816d
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15584614

Change-Id: Id0a6c5b0e7c9cb118df02a9be768b3f68dde43a9
2021-08-18 20:04:09 +00:00
Bart Van Assche 1a9cad816d Reduce the queue depth of loop devices used by the zram driver
Make the queue depth of loop devices identical to that of the underlying
storage device. This patch reduces latency by lowering the queue depth.
With this patch applied I see the following:

 # cat /sys/block/loop30/queue/nr_requests
32

Bug: 194450129
Test: Built Android images, installed these and verified that the queue depth of loop devices is 32 instead of 256.
Merged-In: Ifa16084c7df3a54d9559c2388abc4a8392ff88c6
Change-Id: Icc89e1f88d2f0ade2805999afef556b15b7ff8eb
Ignore-AOSP-First: Already in AOSP.
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-08-18 11:00:31 -07:00
TreeHugger Robot 4dfc8528d8 Merge "libdm: Export ExtractBlockDeviceName()" into sc-dev am: de0cc6cc59 am: b155a9a8a1
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15584613

Change-Id: Ib5046e3855f5c4249eed9676022a77aa93a1adce
2021-08-17 06:07:17 +00:00
TreeHugger Robot b9f40f83eb Merge "libdm: Make ExtractBlockDeviceName() return its result" into sc-dev am: 232ec664b1 am: 10e14c95bc
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15584612

Change-Id: I3b11fd3d20d34a9440ddb74e96a75922877534c7
2021-08-17 06:07:10 +00:00
TreeHugger Robot 9e6087a88e Merge "Rename two local variables" into sc-dev am: d95943088e am: caef6def08
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15584611

Change-Id: I5080775507f23eb67293aadc3e2ce4e7f42e3fd1
2021-08-17 06:07:02 +00:00
TreeHugger Robot b155a9a8a1 Merge "libdm: Export ExtractBlockDeviceName()" into sc-dev am: de0cc6cc59
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15584613

Change-Id: I1221648f11e6fd2ccae40b1ad5d335c31ff8efa1
2021-08-17 05:52:31 +00:00
TreeHugger Robot 10e14c95bc Merge "libdm: Make ExtractBlockDeviceName() return its result" into sc-dev am: 232ec664b1
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15584612

Change-Id: I687f47d10a8aa8c955aab5e3c630f2c735e82c19
2021-08-17 05:52:19 +00:00
TreeHugger Robot caef6def08 Merge "Rename two local variables" into sc-dev am: d95943088e
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15584611

Change-Id: I1a7057d9dd955d425446985cf2ab16955efaa8ce
2021-08-17 05:52:07 +00:00
Bart Van Assche 9e54a90e54 libdm: Export ExtractBlockDeviceName()
Make this function available to libdm users. A caller outside libdm will
be added by a later patch.

Bug: 194450129
Test: mm libfs_mgr libdm_test
Merged-In: I3e3560f3cdef8978eac644d5b53cf3851209c0c2
Change-Id: Ic05cc84565952662178bb649ec97cad6f76dcf92
Ignore-AOSP-First: Already in AOSP.
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-08-16 11:04:40 -07:00
Bart Van Assche 96b21cc589 libdm: Make ExtractBlockDeviceName() return its result
From https://engdoc.corp.google.com/eng/doc/devguide/cpp/styleguide.md:
"Prefer using return values over output parameters: they improve
readability, and often provide the same or better performance (see the C++
Primer)." Implement this advice for ExtractBlockDeviceName(). This patch
does not change any functionality.

Bug: 194450129
Test: mm libfs_mgr libdm_test
Merged-In: I6363781163eba08e6128507b403200f472f68a59
Change-Id: I7d340b33281ebccded0836cd0b5a293e941f4043
Ignore-AOSP-First: Already in AOSP.
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-08-16 11:04:35 -07:00
Bart Van Assche c554240e64 Rename two local variables
Improve code readability by renaming 'device' into 'loop_device' and
'device_fd' into 'loop_fd'.

Bug: 194894000
Test: Built Android images and installed these on an Android device.
Merged-In: Ia9c2d7a525e727f8706e66631b97fc4678c6a4d9
Change-Id: I3fa0c9ca53277b621bb5b81aca394a3079c6e0a3
Ignore-AOSP-First: Already in AOSP.
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2021-08-16 11:04:18 -07:00
Eric Biggers 577e7667d2 Merge "fs_mgr: Look for fstab file in /system/etc" into sc-qpr1-dev am: 1312688506
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15522163

Change-Id: I2c3b74e114c212a941a38131026dbd2e1aad2114
2021-08-12 21:32:53 +00:00
Eric Biggers 4056ccc2e5 fs_mgr: Look for fstab file in /system/etc
Look for the fstab file in /system/etc as an alternative to /, in order
to allow fstab files to be installed using the "prebuilt_etc" Soong
module.

This new path is meant to be used by the vendor ramdisk only. As before,
fstabs should *not* be placed in /system/etc on the system partition.

In more detail: sometimes, multiple nearly-identical fstabs need to be
installed to a device, with the correct one being selected at boot time
(b/191417025 as well as other cases that partners have run into).  To
avoid error-prone duplication of configuration files, these fstabs
should be generated from a template by the build system instead of being
duplicated in the source tree.  But if this is done, the usual way of
installing fstabs (PRODUCT_COPY_FILES) can't be used; they need to be
made into real build system modules instead.

Currently, the "prebuilt_etc" Soong module can't correctly install the
vendor_ramdisk copy of the fstab(s), since it will install it into the
/system/etc directory whereas Android currently requires that the
vendor_ramdisk copy of the fstab(s) be placed in the root directory.

Earlier I proposed adding a "prebuilt_fstab" module to handle this quirk
(https://r.android.com/1744033).  However, it was requested to instead
always look for the fstabs in /etc too, in order to allow "prebuilt_etc"
to be used and because /etc is the appropriate place for this file.
This change implements that suggestion (but actually using /system/etc,
since that is where "prebuilt_etc" actually installs it).

Bug: 191417025
Test: Tested that a device boots both with this, both before and after
      http://ag/15075136 which uses the new location.
Change-Id: Id083070e51ae85959167e4615cd96b31a0b1bd6a
Merged-In: Id083070e51ae85959167e4615cd96b31a0b1bd6a
(cherry picked from commit e98afa2687eb56184dad8569b929eba04fb93068)
2021-08-10 14:55:03 -07:00
Akilesh Kailash c2460a7ca0 Crash during OTA merge may lead to blocks with stale data am: 533c2f6d55
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/core/+/15413918

Change-Id: I09207d3a7d285d116be9b1fce86e62d5115124f5
2021-07-29 22:46:48 +00:00
Akilesh Kailash 533c2f6d55 Crash during OTA merge may lead to blocks with stale data
This is a corner case wherein a crash during OTA
merge can lead to missing of some COW operations to be
merged thereby some blocks may end up with stale data.

Fix here is to avoid any re-ordering of COW operations.
Merge the COW operations as present in the COW file.

New tests have been added to cow_snapuserd.

Bug: 194955361
Test: cow_snapuserd_test, Incremental OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Merged-In: Id895fe7a3d6b4510676490a86d0caf62dec9b079
Change-Id: I14900b9537c4deb7824547e1dfe80f15274bdda4
Ignore-AOSP-First: manual merge from aosp
2021-07-29 16:30:01 +00:00
Nikita Ioffe ba9778a0b5 Add CreateEmptyDevice and WaitForDevice APIs
These APIs support a flow in which dm devices can be created before they
are actually needed, hence minimizing the time a process will wait for
ueventd to create user space paths.

Bug: 190618831
Test: atest libdm_test
Change-Id: I4dfa14e5271a6a13de6da73ec3c7efb1ebc0f8b8
Merged-In: I4dfa14e5271a6a13de6da73ec3c7efb1ebc0f8b8
(cherry picked from commit 15e0f5a98acbec5f00f446ac61d6f79b9ee3bd80)
2021-07-08 02:33:14 +01:00
TreeHugger Robot 9c62cdf3ac Merge "Revert "Completely migrate init first stage to Soong"" into sc-dev 2021-07-07 03:02:01 +00:00
David Anderson e00a567047 libsnapshot: Add a source build fingerprint to the update state.
Bug: 188909957
Test: manual test
Change-Id: I9aa155eee25dd49f48baede4f0a2e4ab2ab76980
Merged-In: I9aa155eee25dd49f48baede4f0a2e4ab2ab76980
2021-07-01 15:43:53 -07:00
Inseob Kim 651db0935d Revert "Completely migrate init first stage to Soong"
Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Update init_first_stage"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert "Add BOARD_BUILD_SYSTEM_ROOT_IMAGE to config vars"

Revert "Add install_in_root to cc_binary"

Revert "Add ramdisk_available to init_first_stage's deps"

Revert submission 15071196-init_first_stage_soong

Reason for revert: fixes b/192248690
Reverted Changes:
I23cf4f975:Add ramdisk_available to init_first_stage's deps
Icd98c7e24:Add ramdisk_available to init_first_stage's deps
If9da9ba16:Add ramdisk_available to init_first_stage's deps
Ibc8668029:Add ramdisk_available to init_first_stage's deps
I3b4b8c475:Add ramdisk_available to init_first_stage's deps
I59cd149e0:Completely migrate init first stage to Soong
I36d789578:Add ramdisk_available to init_first_stage's deps
I2a0daa612:Add BUILD_USES_RECOVERY_AS_BOOT to soong config
Ic76c325ce:Directly create ramdisk dirs in ramdisk image rule...
I4c5374deb:Add BOARD_BUILD_SYSTEM_ROOT_IMAGE to config vars
I8aab5faf3:Add ramdisk_available to init_first_stage's deps
I9d5a10661:Add ramdisk_available to init_first_stage's deps
Iaa2edeb4a:Add ramdisk_available to init_first_stage's deps
I7cb582ca0:Update init_first_stage
I06091d15e:Add ramdisk_available to init_first_stage's deps
I8bdb8dda3:Add ramdisk_available to init_first_stage's deps
I7436b8dd1:Add ramdisk_available to init_first_stage's deps
I39693fd86:Add ramdisk_available to init_first_stage's deps
I0a9ba90f0:Add ramdisk_available to init_first_stage's deps
Ib66b4c4ea:Add ramdisk_available to init_first_stage's deps
I31ce63d23:Add ramdisk_available to init_first_stage's deps
Icb580f97c:Add ramdisk_available to init_first_stage's deps
I044a075b7:Add ramdisk_available to init_first_stage's deps
I33164a7e7:Fix ndk and aml arch order
Ib8d92904a:Add ramdisk_available to sysprop_library
Ibc3516453:Add install_in_root to cc_binary

Change-Id: I147777bb1c4a3b818bc0118c6cf44ccfbf7970a0
2021-07-01 06:50:40 +00:00
Devin Moore 68bb5c4195 Revert "Handle "hardware" bootconfig parameter as "androidboot.hardware""
This reverts commit 0a799bdfd6.
Now that the kernel bootconfig feature has been to updated to handle
mixed subkeys and values, androidboot.hardware parameter is supported.

Test: build and boot Cuttlefish with "androidboot.hardware=cutf_vm"
Bug: 191502832
Merged-In: I0e436a27730d20689bc6974562c3e88d744385db
Change-Id: I0e436a27730d20689bc6974562c3e88d744385db
2021-06-29 12:53:08 -07:00
Inseob Kim 86454f80ef Merge "Completely migrate init first stage to Soong" into sc-dev 2021-06-24 23:21:04 +00:00
David Anderson 91b351ea7b Perform a consistency check before deleting snapshots.
If for some reason the COW state is not fully synced to disk, but
dm-snapshot has flushed its pending merges, we do not want to delete
snapshots. Doing so could potentially leave blocks unmerged.

This situation is quite unexpected so we label it as a merge failure.
The device can recover by completely syncing the COW state, and then
rebooting, which will attempt to make forward progress on the merge.

Bug: 190582627
Test: vts_libsnapshot_test
      full OTA on bramble
      incremental OTA on bramble
Change-Id: Ib887f1d9e4397a712ed2f800cc1222cf9305a039
Merged-In: Ib887f1d9e4397a712ed2f800cc1222cf9305a039
2021-06-23 19:12:01 -07:00
Inseob Kim 7418252a4e Completely migrate init first stage to Soong
adb_debug.prop is migrated too. And ramdisk_available is added to all
dependencies.

Bug: 187196593
Test: boot
Change-Id: I59cd149e0021211b8fd59c44b93bbf18dc8637bf
Merged-In: I59cd149e0021211b8fd59c44b93bbf18dc8637bf
2021-06-23 04:26:12 +00:00
Yi-yo Chiang 8f654d8a99 Merge changes Iaf2ec527,I6d6abd44,I6304e0de,Ia4fbce58,I3b60dfa4, ... into sc-dev
* changes:
  first_stage_mount: mount point must be canonical path
  fs_mgr_fstab: Parse overlayfs options from fs flags
  Remove deprecated fs_mgr_overlayfs_required_devices()
  adb-remount-test: Make awk scripts mawk-v1.3.3-compatible
  Make fs_mgr_overlayfs_mount_fstab_entry() available for user builds
  adb-remount-test: Strengthen skip_administrative_mounts
  fs_mgr_overlayfs_mount_fstab_entry(): Rename source device name
  fs_mgr_overlayfs: Polish fs_mgr_overlayfs_mount_fstab_entry()
  first_stage_mount: Remove "overlay" hack from InitRequiredDevices()
  fs_mgr_vendor_overlay: Mount vendor overlay with noatime
2021-06-08 07:51:52 +00:00
Yi-Yo Chiang 84fe96bfbc first_stage_mount: mount point must be canonical path
Ban weird paths such as /../system or //vendor in first stage mount.
Add utility function fs_mgr_create_canonical_mount_point() that:

* mkdir(mount_point) to ensure mount_point's existence
* Test that realpath(mount_point) =?= mount_point

Bug: 188898525
Test: Presubmit
Test: Boot CF
Change-Id: Iaf2ec52701277f26cc81f3e15a47b6083a788334
Merged-In: Iaf2ec52701277f26cc81f3e15a47b6083a788334
(cherry picked from commit 3431d52675f25020b279c9fbcda6b8648f9cf67b)
2021-06-03 15:53:12 +08:00
Nikita Ioffe 8c427b9f67 libdm: Add DeleteDeviceDeferred API
This can be useful in case when a device mapper device can't be deleted
straight away, and instead delete needs to be enqueued until last
reference to the device is closed.

Bug: 187864524
Bug: 188713178
Test: atest libdm_test
Change-Id: Ie8a130baa54e6e16d8d159389bd760bf873eca40
Merged-In: Ie8a130baa54e6e16d8d159389bd760bf873eca40
(cherry picked from commit d13cef743545c6de7b5122cb515bb82b508d019e)
2021-06-02 16:13:45 +01:00
Yi-Yo Chiang a79bc0d1b3 fs_mgr_fstab: Parse overlayfs options from fs flags
Parse the "lowerdir=" option from fs mount flags instead of fs_mgr flags
for consistency.

Before:

  none /mnt/product/test1 overlay ro lowerdir=/1:/2,first_stage_mount

After:

  none /mnt/product/test1 overlay ro,lowerdir=/1:/2 first_stage_mount

Bug: 188862155
Test: Boot to normal with overlayfs mount entries in first stage fstab
Change-Id: I6d6abd44ab32afadec428005f4aece834f9c8905
Merged-In: I6d6abd44ab32afadec428005f4aece834f9c8905
(cherry picked from commit 7b81023e2a0d48c5e919bb314990555db37bf21e)
2021-06-02 16:54:39 +08:00
Yi-Yo Chiang bbe9268671 Remove deprecated fs_mgr_overlayfs_required_devices()
It is unused since Ifc8720378259654472d3822e97059b6c366f601d

Bug: 188862155
Test: Build pass
Change-Id: I6304e0dedb36d03a87c556083e937b4a2ce30b1b
Merged-In: I6304e0dedb36d03a87c556083e937b4a2ce30b1b
(cherry picked from commit a07ed968b563f15b35b68c701a97eb239bb34c4c)
2021-06-02 16:54:11 +08:00
Yi-Yo Chiang aedf0fbce8 adb-remount-test: Make awk scripts mawk-v1.3.3-compatible
Our CI is failing because the host machine is using mawk instead of gawk.
mawk v1.3.3 cannot parse regex such as '/[/]/', while mawk v1.3.4 and
gawk can.
Change regex of '[/]' to '\/' so that our test script is as backward
compatible as possible.

Bug: 188862155
Test: Run adb-remount-test.sh on CI
Change-Id: Ia4fbce58a61325a5e5280ede0d5b7760832d8ec1
Merged-In: Ia4fbce58a61325a5e5280ede0d5b7760832d8ec1
(cherry picked from commit ad3a57bdbaa05fd531a05373a07f0435a9d5dc33)
2021-06-02 16:53:27 +08:00
Yi-Yo Chiang 18a6cc2bac Make fs_mgr_overlayfs_mount_fstab_entry() available for user builds
Rename fs_mgr_overlayfs_mount_fstab_entry() to
fs_mgr_mount_overlayfs_fstab_entry() and move it out of
fs_mgr_overlayfs.cpp to make it available for user builds.

Add checks to unsure overlayfs mount point doesn't contain symbolic
link or /../.

Check the mount point with an allowlist if user build. The mount point
should either be /vendor, /product ... or their submounts, or strict
submounts of /mnt/vendor and /mnt/product.

Bug: 188862155
Test: Boot test with overlayfs mount entries on user build
Change-Id: I3b60dfa4b63cf2ae0754f53d1d08365aa7be1ee0
Merged-In: I3b60dfa4b63cf2ae0754f53d1d08365aa7be1ee0
(cherry picked from commit 23816e84ca8821f303d9a3e753d7c050881bacd5)
2021-05-27 16:55:28 +08:00
Yi-Yo Chiang 8570398065 adb-remount-test: Strengthen skip_administrative_mounts
Refactor skip_administrative_mounts so that it filters by device name,
mount point and filesystem type. (Was filtering by device name and mount
point.)

We need this because pseudo filesystems such as tmpfs and overlayfs can
have free-formed device name:

  blah /mnt/mnt_point overlay ro,lowerdir=...

However the filesystem type (third field of /proc/mounts) must be
reflecting the actual filesystem, so to robustly filter out
administrative filesystems, we have to check the filesystem type field.

Bug: 188862155
Test: adb-remount-test.sh
Change-Id: I5058cbe8a36920f25b73a5d5833e9fc5a096e90f
Merged-In: I5058cbe8a36920f25b73a5d5833e9fc5a096e90f
(cherry picked from commit f931ad94465c24b8056618f85978af14c052079f)
2021-05-26 15:33:18 +08:00
Yi-Yo Chiang a38c89a2f0 fs_mgr_overlayfs_mount_fstab_entry(): Rename source device name
adb-remount-test.sh would fail if a overlayfs named "overlay" is mounted
in first_stage_init via fs_mgr_overlayfs_mount_fstab_entry():

  [  FAILED  ] overlay takeover unexpected at this phase

Prepend the source device name with "overlay-", so that the overlayfs
mounted by fs_mgr_overlayfs_mount_fstab_entry() mustn't be named
"overlay".

Bug: 188862155
Test: adb-remount-test.sh
Change-Id: Ia0b3f1c92ed5650c3e584fba23758344a4733657
Merged-In: Ia0b3f1c92ed5650c3e584fba23758344a4733657
(cherry picked from commit 7b90e6936c66b67a6761f7ad086a68bbcaf23c05)
2021-05-26 15:33:03 +08:00
Yi-Yo Chiang 94d1f3b4fa fs_mgr_overlayfs: Polish fs_mgr_overlayfs_mount_fstab_entry()
* Add logs.
* Append "override_creds=off" overlayfs mount flag only if
  fs_mgr_overlayfs_valid() returns kOverrideCredsRequired.
  Pre-4.6 kernels or kernels without the override_creds patch don't
  need or don't recognize the override_creds mount flag.
  (Background: I832c8ca3fce0269bdef4ce988541adb7ba9662ed)
* mkdir(mount_point) before mount() to ensure the mount point exists.
  This could happen if the mount point is in a tmpfs, such as /mnt.

Bug: 188862155
Test: Boot to normal with overlayfs mount entries in first stage fstab
Change-Id: I1a05696346610d7fd61de6d25c379520fd58ca9b
Merged-In: I1a05696346610d7fd61de6d25c379520fd58ca9b
(cherry picked from commit dcf1c1f46235637a6d1057c88e6d1fed88e1b90a)
2021-05-26 07:31:19 +00:00
Yi-Yo Chiang 1d56fe6538 fs_mgr_vendor_overlay: Mount vendor overlay with noatime
Change relatime to noatime as our filesystems and partitions are all
read-only, so relatime doesn't really work in the first place.

Bug: 188862155
Test: atest -v fs_mgr_vendor_overlay_test
Test: Presubmit
Change-Id: I869bba24c2d6d8a986bf0eec0f487ba7b935ab4b
Merged-In: I869bba24c2d6d8a986bf0eec0f487ba7b935ab4b
(cherry picked from commit 7cbed5a9cec9df1a5ce99f9b61743ffd7e8fe7b7)
2021-05-25 05:14:51 +00:00
Akilesh Kailash 24305239d6 snapuserd: Send header-response once per entire IO request
Header response from daemon is sent once at the
beginning of the payload. This is a corner case
when the IO request can get broken into multiple chunks
if the IO is un-aligned.

Additionally, add error checks in the IO path
to validate sector information when the read
requests are merged.

Bug: 188361387
Test: Simulate an IO request to forcefully break the IO
response into multiple chunks and verify the correctness.

Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: I1f4fa7a79c60493f4bbed3ad49e257098b930beb
Merged-In: I1f4fa7a79c60493f4bbed3ad49e257098b930beb
2021-05-19 01:01:52 +00:00
David Anderson b2ee4c14c9 libsnapshot: Move ImageManager creation to DeviceInfo.
This refactoring moves ImageManager creation out of SnapshotManager,
where it had always been rather awkward, and into IDeviceInfo so it can
participate in dependency injection.

The "first-stage init" state is now part of IDeviceInfo as well.

Bug: 187396878
Test: vts_libsnapshot_test
      libsnapshot_fuzzer_test
Change-Id: Ic4b3e93527cc074ec18c0c26440dbdb2504d0d5e
2021-05-13 11:33:38 -07:00
Akilesh Kailash 2a89cf82fa snapuserd: Remove assertions from daemon
Assertions in daemon will terminate the daemon.
This can bring the entire device to halt as the mount partitions
are mounted of snapshot devices and IO's will be hung in
"D" (uninterruptible state) eventually leading to sysrq crash.

Convert the relevant assertions into appropriate error codes and
propagate the error code back to dm-user.
IO will eventually fail but should not impact the overall usage of the device.

Bug: 187903835
Test: vts_libsnapshot, cow_snapuserd_test, full OTA
Signed-off-by: Akilesh Kailash <akailash@google.com>
Change-Id: Iaf093898837d2aff5703ea1e615aecf7c1e53a8f
2021-05-12 17:31:38 +00:00
Treehugger Robot 661c65dc07 Merge "Fix CtsFsMgrTestCases failures" 2021-05-11 07:13:17 +00:00
Yi-Yo Chiang e3cbb0a9eb Fix CtsFsMgrTestCases failures
fs_mgr flags "slotselect" and "slotselect_other" are specific to A/B
devices, so remove these options from testcases because
CtsFsMgrTestCases could be ran on a non-A/B device.

Fixes: 187759127
Fixes: 187427233
Test: atest CtsFsMgrTestCases on sdk_phone64_x86_64-userdebug
Change-Id: I31c1429652629bb68e0ca504295c959ac7e013e2
2021-05-11 07:12:22 +00:00