b6663cfb5a
We used to flock() on /metadata/ota/state to ensure atomic access. However, writing the file itself is not necessary atomic and may lead to inconsistent states. This change redirects flock() to the outer directory, /metadata/ota, which is very likely to exist (see exception below). flock() is called on this directory instead of /state. This allows a follow-up change to turn all writes to the /metadata partition atomic. Note: /metadata/ota may not exist during first boot after a flash with wipe. However, first_stage_init always checks existence of boot indicator before even trying to flock() (via IsSnapshotManagerNeeded() and NeedSnapshotsInFirstStageMount()). If the boot indicator exists, /metadata/ota must exist as well. Also add tests to ensure LockExclusive() and LockShared() works as expected. Test: libsnapshot_test Test: apply OTA from older build to this, then reboot Bug: 144549076 Change-Id: Ib4dd9e9be1a43013c328e181b9398ac0b514dbce |
||
---|---|---|
.. | ||
android/snapshot | ||
include/libsnapshot | ||
Android.bp | ||
device_info.cpp | ||
device_info.h | ||
dm_snapshot_internals.h | ||
OWNERS | ||
partition_cow_creator.cpp | ||
partition_cow_creator.h | ||
partition_cow_creator_test.cpp | ||
snapshot.cpp | ||
snapshot_metadata_updater.cpp | ||
snapshot_metadata_updater.h | ||
snapshot_metadata_updater_test.cpp | ||
snapshot_test.cpp | ||
snapshotctl.cpp | ||
snapshotctl.rc | ||
test_helpers.cpp | ||
test_helpers.h | ||
utility.cpp | ||
utility.h |