History log of /system/core/fs_mgr/fs_mgr.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
e1442a5df03c71d3f04f64304803f20376e83557 15-Jul-2017 Tom Cherry <tomcherry@google.com> Merge changes from topic 'ext4_encryption_flag' am: 5be05733c2 am: 5a6226929e
am: d165de95da

Change-Id: I11ebc6c79bcd5cf6b8fd619b1a71582b7c788d41
5be05733c2cba89471f8b7c7e22094f96da5dcf1 15-Jul-2017 Tom Cherry <tomcherry@google.com> Merge changes from topic 'ext4_encryption_flag'

* changes:
fs_mgr: set ext4 encryption flag with tune2fs when needed
fs_mgr: refactor pre-mount logic into prepare_fs_for_mount()
e9811f36e508785504db2a87d93dbbd89bf2b9a9 05-Jul-2017 Eric Biggers <ebiggers@google.com> fs_mgr: set ext4 encryption flag with tune2fs when needed

Upstream kernels (v4.9+, v4.4.67+) have started to enforce that
encryption policies cannot be set on ext4 directories unless
EXT4_FEATURE_INCOMPAT_ENCRYPT is set in the filesystem superblock, as
was the original design. Since Android's userspace was not setting this
flag, it was not possible to use "file-based encryption" (FBE) on
devices whose kernels enforce this constraint. Fix this by updating
fs_mgr to set the flag if needed, similar to how it enables the quota
feature if needed.

Note that it would, eventually, be simpler to set this flag at mkfs
time. But that seems infeasible for now, given the many different ways
the userdata filesystem can be formatted --- including via 'fastboot',
which I believe is expected to still be compatible with old devices
whose kernel and/or e2fsprogs don't support the 'encrypt' flag.

Bug: 36231741
Change-Id: Ibafb9a7116fc853b62f8ee074a78499399f290a6
/system/core/fs_mgr/fs_mgr.cpp
8d3bcd4b6a3bdf2fd1302bd6e89413ff57168e0d 05-Jul-2017 Eric Biggers <ebiggers@google.com> fs_mgr: refactor pre-mount logic into prepare_fs_for_mount()

There were several duplications in the code that runs before a
filesystem is mounted. This made it difficult to start running tune2fs
to set the encryption feature flag. Refactor to deduplicate the logic,
and improve the log messages.

Bug: 36231741
Change-Id: I90846dad9c5ec85b3c5460615dec4cc19cb7e198
/system/core/fs_mgr/fs_mgr.cpp
febf2ad9d7d2c3a4c171b7a766e534601645cf49 06-Jul-2017 Jinguang Dong <dongjinguang@huawei.com> Merge "fs_mgr: Adding logs when failing to wait for a device file" am: 4ca2a30368 am: 694985721f
am: 0ac18b28cd

Change-Id: I055425b0dfdbccbfa9c72e9bb1390ea483afdb9c
4ca2a30368a0ae150a97a07b997ddaaf3df88d4d 06-Jul-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "fs_mgr: Adding logs when failing to wait for a device file"
9d344969b03fd19a6f5c485ddd7c8dd22b7d3a9d 13-Jun-2017 Jinguang Dong <dongjinguang@huawei.com> fs_mgr: Adding logs when failing to wait for a device file

During mount operations, fs_mgr_wait_for_file() is invoked to
ensure the device file exists before starting to mount it. Adding
logs when the wait fails and also skip mounting as it won't be
successful. Also merge fs_mgr_test_access() and wait_for_file()
as fs_mgr_wait_for_file().

Test: Boot device and manually trigger the timeout issue
Test: Check and confirm whether timeout log info is inside ksmg.

Change-Id: Ide6d7fdca41e03e169e4400f91b7dea327985aaf
/system/core/fs_mgr/fs_mgr.cpp
3f10ecabf805fb49300001fad83310e349136ae3 06-Jul-2017 Bowgo Tsai <bowgotsai@google.com> Merge "fs_mgr: allow no verity metadata when the device is unlocked." am: cd0c2d8962 am: 328b56585e
am: 06c6bf67e9

Change-Id: Id1f3d275fdeadca1b23a086725b3f63aedc5a141
cd0c2d8962ae692b113387656aea3c6e459dc3db 06-Jul-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "fs_mgr: allow no verity metadata when the device is unlocked."
0c7862b8058c6edbfb3c1e9fd0441a6245fad787 05-Jul-2017 Mark Salyzyn <salyzyn@google.com> Merge "fs_mgr: report errno string for __mount errors" am: 6333cd0938 am: eef732555d
am: ab6f80c350

Change-Id: I1dcef448c82402404652921f8113b2a576158f57
d1fe3bdbd6bcdc7f268f045e6b3b77de4d837a21 05-Jul-2017 Bowgo Tsai <bowgotsai@google.com> fs_mgr: allow no verity metadata when the device is unlocked.

To boot with generic system.img for project Treble, we should allow no verity
metadata when the device is unlocked. The previous fix checks system property
"ro.boot.flash.locked" but it's unavailable during first stage mount.
This CL checks "androidboot.verifiedbootstate" in kernel command line instead.

Bug: 63268209
Test: boot sailfish without metadata on /vendor

Change-Id: Ifd1dbeb2a2f09cd06903ecdd59bc94b3905a3fbd
/system/core/fs_mgr/fs_mgr.cpp
69a5bd4357a49b63204e7f56cf34a13fa75a7e88 28-Jun-2017 Mark Salyzyn <salyzyn@google.com> fs_mgr: report errno string for __mount errors

Need to know why the mount failed. clang_format adjustment.

Basically change LINFO to PINFO to cause the log message for the mount
report to be accompanied by a strerror(errno) message appended to the
end so that it is clear why the mount was rejected.

Test: manual
Bug: 63100799
Change-Id: Ic958299759befe5d5b11bdc95fea5d64cad86412
/system/core/fs_mgr/fs_mgr.cpp
61cdb66230218a27d68d4c4c9702b536cbf4e618 24-Jun-2017 Bowgo Tsai <bowgotsai@google.com> Merge "AVB: allow no metadata in the generic system.img for project Treble" am: c70bf5836c am: caa5b4417f
am: 2410d0c792

Change-Id: I5b03a7ac1cdb883df27aca8122c4a1383d805126
60f19a079203dbb187cb6af5a1c594496832c191 22-Jun-2017 Bowgo Tsai <bowgotsai@google.com> AVB: allow no metadata in the generic system.img for project Treble

The generic system.img released from project Treble can't contain any verity
metadata (e.g., vboot 1.0, AVB, or any other implementation) because it's
*generic*. To make any device can boot with it, `avbctl disable-verification`
is introduced to set a new flag AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED
in the top-level vbmeta to disable the entire AVB verification process. This
should be done prior to flash the generic system.img. See the following link
for details:

https://android-review.googlesource.com/#/c/418399/

This CL checks whether AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED is
set in the top-level vbmeta. When set, skip verifying the vbmeta structs
against androidboot.vbmeta.{hash_alg, size, digest} because it will be
absent in kernel cmdline. Also, only top-level vbmeta struct is read then
returned by libavb in this case.

Note that another flag AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED, usually
set by `adb disable-verity`, is used to signal fs_mgr to skip setting up
dm-verity, but libavb still verifies all vbmeta structs. fs_mgr will
also verify all vbmeta structs against androidboot.vbmeta.{hash_alg,
size, digest} from kernel cmdline as well.

Also rename SetUpAvb() to SetUpAvbHashtree() to better fit its usage.
This function will return kDisabled when any of the above two flags is set.

Finally, regardless of which flag is set or not set, we still only allow two
return values from avb_slot_verify():

- AVB_SLOT_VERIFY_RESULT_OK: it's still possible to get this value
when any of these flags are set in build time. e.g.,
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS=--flags 2

- AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION: in most cases we should
get this value, because the flags are likely set at run time.

Bug: 62523303
Test: boot device with 'avbctl disable-verification'.
Test: boot device with 'avbctl enable-verification'.
Test: boot device with 'adb disable-verity'.
Test: boot device with 'adb enable-verity'.

Test: build image with BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS=--flags 2, then boot device.
repeat the above steps to boot device again.

Change-Id: Ie8436f3e0e82c78490208f3b85eac5238a9fdfdb
/system/core/fs_mgr/fs_mgr.cpp
2980f494472a5b5aa065158c3132479a715388c0 22-Jun-2017 Sandeep Patil <sspatil@google.com> Merge changes from topic 'eng_first_stage_mount' am: b7e2f272ee am: e5341cf56a
am: 91b5f4b172

Change-Id: Iea367c4aa1a9fe381c4b5b4b23f6365035b4939d
95366e97ddff7fcfc095481f69bbd7f699715c99 21-Jun-2017 Sandeep Patil <sspatil@google.com> fs_mgr: differentiate if fs_mgr_set_verity() was skipped or disabled

In case of non-secure builds (eng variant) fs_mgr_setup_verity() skips
verity checks regardless of fstab options. This is slightly different
than 'adb disable-verity' where it would first read the verity metadata
to check if verity is disabled.

So, this change adds a new return value of FS_MGR_SETUP_VERITY_SKIPPED
instead of piggy backing on the FS_MGR_SETUP_VERITY_DISABLED.

Bug: 62864413
Test: Boot sailfish

Change-Id: I42bf2bdce0ecb18b4c3b568e2bc96bf1590dfb35
Signed-off-by: Sandeep Patil <sspatil@google.com>
/system/core/fs_mgr/fs_mgr.cpp
efa3c047e2b1bf9ec3843de8f2e75e0e092910e0 01-Jun-2017 Jinguang Dong <dongjinguang@huawei.com> Merge "fs_mgr: Fix ZRAM error when ZRAM disk size beyond (2^31-1) bytes" am: 28c11dcff4 am: 6a75b73c36 am: 40d4ad9cdf
am: 1123da7a42

Change-Id: If57135eb48c0f9376eb6a4c658d60b99573930e3
f7d1014795fd0993c16ab44d45981b386d681424 01-Jun-2017 Jinguang Dong <dongjinguang@huawei.com> fs_mgr: Fix ZRAM error when ZRAM disk size beyond (2^31-1) bytes

Because the zram_size type is unsigned int.so if ZRAM size great
than 2^31 -1, zram_fp will receive a negtive integer, while the
ZRAM driver only accept natural number.We need to use printf
formatting %u instand of %d.

Test: 1. Config the zramdisk size 2348810240 and build a ramdisk
2. Reflash device and check below command:
$adb shell dumpsys meminfo
$ adb shell cat /sys/block/zram0/disksize
ZRAM info display will be abnormal
3. Config the zramdisk size 2348810240 and apply with this
patch.
4. Retest to step 2 and the ZRAM info will be ok.

Change-Id: I473de33fbd0b66cf13eac3172684e9fef11b6ef0
/system/core/fs_mgr/fs_mgr.cpp
25b83186cca108c800c8b3a805b09f6df9c312df 24-May-2017 Bowgo Tsai <bowgotsai@google.com> Merge "fs_mgr: fix SIGSEGV when ostream << nullptr" am: 225f0d98c8 am: 9af4b13b8f am: 942b4efa2e
am: 63d224a2bc

Change-Id: I2798cd3e57b89a5a8b48d72d62f00b749cc690d9
59af33c9ed6f8436fae599c37f4b8e8e7e9b71fa 24-May-2017 Bowgo Tsai <bowgotsai@google.com> fs_mgr: fix SIGSEGV when ostream << nullptr

fstab_rec.fs_options might be nullptr when printing error message.
Use android::base::StringPrintf() to '(null)' when needed.

Bug: 37759782
Test: Boot device and manaully trigger the output
Change-Id: I1bdf4ba57331aaea9dd5e790f6bf9d9b8bdc8b53
/system/core/fs_mgr/fs_mgr.cpp
8301fcfcf5ea3de5e0926e549bd7fbe0f2e7b6c8 10-May-2017 Bowgo Tsai <bowgotsai@google.com> Merge "first stage mount: removing the requirement of by-name prefix for AVB" am: cdad92fdad am: c82235ebbd am: fec0b13902
am: acef4a9a09

Change-Id: I51e8a7df3db76a7cd626ee2ad2960abc5ec2256d
20651f62d081c88596e70b3b589863a75e2a9c35 08-May-2017 Bowgo Tsai <bowgotsai@google.com> first stage mount: removing the requirement of by-name prefix for AVB

Current first stage mount for AVB requires specifying a common prefix of
by-name symlink for all AVB partitions. It limits all AVB partitions to be on
the same block device.

firmware {
android {
compatible = "android,firmware";
vbmeta {
compatible = "android,vbmeta";
parts = "vbmeta,boot,system,vendor";
by_name_prefix="/dev/block/platform/soc.0/f9824900.sdhci/by-name" <-- *removing this*
};
fstab {
compatible = "android,fstab";
vendor {
compatible = "android,vendor";
dev = "/dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor";
type = "ext4";
mnt_flags = "ro,barrier=1,inode_readahead_blks=8";
fsmgr_flags = "wait,avb";
};
};
};
};

For normal mount with AVB, it extracts the by-name prefix of /misc
partition and use it as the prefix for all other partitions:
- /dev/block/platform/soc.0/f9824900.sdhci/by-name/misc ->
- /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor_a

Fix this by adding an internal map in FsManagerAvbOps to record the mapping
from partition name to its by-name symlink:

ByNameSymlinkMap["vendor_a"] = "/dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor_a"

Two overloaded factory methods are then provided for FsManagerAvbUniquePtr:
- FsManagerAvbUniquePtr Open(ByNameSymlinkMap&& by_name_symlink_map):
for first stage mount, where the by-name symlink map will be
constructed externally, from the uevents processed by init, before
invoking this factory method.

- FsManagerAvbUniquePtr Open(const fstab& fstab): for normal mount,
where the by-name symlink map will be constructed from the input fstab
internally.

Bug: 37552224
Test: first stage mount /vendor with vboot 1.0
Test: first stage mount /vendor with vboot 2.0 (AVB)
Test: normal mount /vendor with vboot 2.0 (AVB)
Change-Id: Id17e8566da87ea22b8923fcd6e47db8d45bc7d6a
/system/core/fs_mgr/fs_mgr.cpp
eb73fcdcb83fe61cb1dd2fe081f458d24ed5e217 05-May-2017 Keun-young Park <keunyoung@google.com> Merge "use passed blk dev name for quota / super block check" am: 7b706c5b9e am: 2f3718c472 am: d31f3a0e9b
am: f7aacf81fa

Change-Id: Ib818fb98b6c01ef041cf6339c590b3f3185553ca
951968841145a45c423463e8cd9de592cc264f5f 05-May-2017 Keun-young Park <keunyoung@google.com> use passed blk dev name for quota / super block check

- It was using blk dev name from fstab and quota / super block check was always
failing for FDE

bug: 37913441
Test: reboot and confirm quota
Change-Id: I8a9e890ef2787f2959e6a0225c6b21d35602f19e
/system/core/fs_mgr/fs_mgr.cpp
7fe58ba5b66a34b7eb83020d1248075291bf4ba8 29-Apr-2017 Bowgo Tsai <bowgotsai@google.com> Merge "fs_mgr: code clean up" am: 0914d2bdff am: 0bb2ebbe74 am: f7cc23bf3a
am: 1bd2d1c3a5

Change-Id: Id37b33ccb4f5127bd0e5b16bff2c79a1819623ed
0914d2bdff7dcaa3acc58a7556dd46e4910222b8 29-Apr-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "fs_mgr: code clean up"
359bed36156fe1602285c75745806d8488cf927b 27-Apr-2017 Bowgo Tsai <bowgotsai@google.com> fs_mgr: code clean up

- Returns FS_MGR_MNTALL_FAIL for failure paths in fs_mgr_mount_all()
- Removes the 'goto out' in fs_mgr_do_mount() as there is nothing to do in
the 'out' label now. Also removes the "ret = FS_MGR_DOMNT_FAILED;" and
just return FS_MGR_DOMNT_FAILED directly for the default failure path.
- Changes some LERROR to PERROR

Test: Use fs_mgr_do_mount() to mount /system with AVB
Change-Id: I126a0124a5c9d61302f40ab9db16989500d9777e
/system/core/fs_mgr/fs_mgr.cpp
92e5f2d91228f95622da6b6de6be2f0e997084ec 28-Apr-2017 Bowgo Tsai <bowgotsai@google.com> Merge "fs_mgr: set "partition.system.verified" when AVB is used in a A/B device" am: 5c7543569a am: b66306c7c1 am: 50f7d4a1ab
am: 5547de8f8e

Change-Id: I86c4cf36fd6390a4af111d59f58327c801c4c267
48fdc292f96e66d33d577bdf5a6da7cb0f5f791a 27-Apr-2017 Bowgo Tsai <bowgotsai@google.com> fs_mgr: set "partition.system.verified" when AVB is used in a A/B device

In a A/B device, system partition is mounted by kernel as root.
In vboot 1.0, the dm device name of system partition is "system" with
the following configuration in kernel command line:
- dm="system none ro,0 1 android-verity /dev/sda34"

In AVB, the dm device name is switched to vroot as:
- dm="1 vroot none ro 1,0 5201456 verity 1 ..."

When sending ioctl DM_TABLE_STATUS to query status, we should use "vroot" as the
dm device name for AVB. But still pass "system" for the callback function to set
property [partition.system.verified] instead of [partition.vroot.verified].

Bug: 36900078
Test: Use AVB to mount system in a A/B device, checks the property exists
[partition.system.verified]
Test: Use vboot 1.0 to mount system in a A/B device, checks the property exists
[partition.system.verified]
Test: Checks 'adb remount' will output warning message:
- dm_verity is enabled on the system and vendor partitions.
- Use "adb disable-verity" to disable verity.

Change-Id: Iaee7eb2b00b03729bc07fa24f1b449488716d2ea
/system/core/fs_mgr/fs_mgr.cpp
9dbe97b4d502ef4b7e45775190875882fbaf42e2 21-Apr-2017 Paul Lawrence <paullawrence@google.com> Support metadata encryption

Bug: 29189559
Test: Angler, Marlin build and boot
Change-Id: Ia7b070781f5f16ff8bfd934569a2209c80c28385
/system/core/fs_mgr/fs_mgr.cpp
40db04d640f42afb544ebc4a4789bd38ddabedfb 14-Apr-2017 Keun-young Park <keunyoung@google.com> run e2fsck -f selectively with mount retry

- Do not use -f if it was cleanly shutdown.
- For unclean shutdown or other operation failures like
mount, tune2fs failure, run full check.
- Still old image will run full check once in 5 reboots
while new image will not run full check unless something
fails.
- Add retry for final mount. If mount fails once, run full fsck
once and try again.

bug: 32246772
bug: 35366616
Test: many reboots
Change-Id: I86949732ffe1955636ac179d553c91e52910f73e
/system/core/fs_mgr/fs_mgr.cpp
d73be1b96beab812b86f8174e7fc928291f0cb44 14-Apr-2017 Steven Moreland <smoreland@google.com> libcutils: compile with BOARD_VNDK_VERSION current

- moved __android_log_is_debuggable to a new public header
(log_properties.h)
- vendor version of sched_policy uses ALOG* instead SLOG*

Test: (sanity) liblog-unit-tests
Test: (sanity) libcutils_test (noting b/b/32972117, two tests continue
to fail)
Test: system/core as a whole makes with BOARD_VNDK_VERSION := current
now with no problems.
Test: boots/works on internal marlin
Bug: 33241851

(cherry picked from commit 1f83aa424f537cf3f07e1d27dbbcc524818b5358)

Merged-In: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
Change-Id: I5bc1f348dc0f0c8814bec5b5c3d2c52c825ab640
/system/core/fs_mgr/fs_mgr.cpp
82bd278dc4ed6e62b0aebec84cb2bde793823b35 15-Apr-2017 Keun-young Park <keunyoung@google.com> Merge "check ext4 magic before running next steps"
aaf70e77dc232fde152249bb6f66a227eab35a10 01-Mar-2017 Bowgo Tsai <bowgotsai@google.com> fs_mgr: support AVB in fs_mgr_update_verity_state()

fs_mgr_update_verity_state() is invoked by 'verity_update_state' in
init.rc. It will then set property "partition.system.verified" and
"partition.vendor.verified" to verify_mode. We should support this for
AVB as well.

Also change the order of static libs in init to fix the build error
after this change:
system/extras/ext4_utils/ext4_crypt.cpp:69: error: undefined reference to 'property_get'

Bug: 35416769
Test: Mount /system and /vendor with vboot 2.0 (AVB), check the following properties exist.
- [partition.system.verified]: [2]
- [partition.vendor.verified]: [2]
Test: Mount /system and /vendor with vboot 1.0, check the following properties exist.
- [partition.system.verified]: [0]
- [partition.vendor.verified]: [0]

Change-Id: I4328d66a8cb93f26e7960e620a0b2292d5f15900
/system/core/fs_mgr/fs_mgr.cpp
6000a3f65720757279707193d940c0942abfe9c7 12-Apr-2017 Keun-young Park <keunyoung@google.com> check ext4 magic before running next steps

- mount, e2fsck, tune2fs will all fail if magic number does not match.
- mismatch always happen for FDE and is wasting boot-up time to try
all and fail always.
- skip mount steps if it has invalid magic number and do not record
fs_stat either.
- For ext4 fs with corrupt superblock, e2fsck refuses to do anything if
superblock magic is invalid. So simply running e2fsck does not help
anyway.

bug: 36231950
Test: reboot ane check fs_mgr log from dmesg
Change-Id: I9ad9e0cd30fd074b3bbf8f450bd401b133d5771a
/system/core/fs_mgr/fs_mgr.cpp
80d1ad17ed5dd1ca63cc3cca24e801c9f63bc48f 13-Apr-2017 Bowgo Tsai <bowgotsai@google.com> fs_mgr: adds/changes some public APIs for early mount in init

Several changes in this CL:
- Moves class FsManagerAvbHandle to public API
- Adds a parameter 'wait_for_verity_dev' for FsManagerAvbHandle::SetUpAvb()
to allow not to wait for verity device gets created
- Adds FsManagerAvbHandle::AvbHashtreeDisabled() to query whether AVB is disabled
- Adds fs_mgr_is_avb() to query whether a fstab_rec has MF_AVB flag

Bug: 33254008
Test: test AVB on bullhead
Change-Id: I89c43ca574ae632db8a700fc2590a1f80212c993
/system/core/fs_mgr/fs_mgr.cpp
95c966a8599a069c40707c933c31155d625bd355 30-Mar-2017 Bowgo Tsai <bowgotsai@google.com> fs_mgr_avb: refactors how vbmeta is loaded

Adds two classes FsManagerAvbhandle and FsManagerAvbVerifier to replace the
following functions or struct:

- fs_mgr_load_vbmeta_images() -> FsManagerAvbhandle::Open()
- fs_mgr_unload_vbmeta_images() -> deleted
- fs_mgr_setup_avb() -> FsManagerAvbhandle::SetUpAvb()

- androidboot_vbmeta -> FsManagerAvbVerifier
- load_vbmeta_prop() -> FsManagerAvbVerifier::Create()
- verify_vbmeta_images() -> FsManagerAvbVerifier::VerifyVbmetaImages()

And only invokes FsManagerAvbhandle::Open() when there is a fstab entry having
'avb' flag (need HASHTREE descriptor). fs_mgr_is_avb_used() can be
removed as it only checks system property "ro.boot.vbmeta.hash_alg" to
decide whether vbmeta needs to be loaded, which might not be accurate.

For example, there are only HASH descriptors in the verified chain but
no HASHTREE descriptors. In this case, the fs_mgr doesn't have to do
anything because it only takes care of HASHTREE descriptors.

Also adds a new class FsManagerAvbOps to provide the C++ binding
FsManagerAvbOps::AvbSlotVerify() for libavb->avb_slot_verify().

Bug: 33254008
Test: test AVB on bullhead
Change-Id: I8fe15ba01c277152630a2a5c1c5c7f25fbf34030
/system/core/fs_mgr/fs_mgr.cpp
95e233f9ff4d51bbafc6314b88920f553edd365f 07-Apr-2017 Keun-young Park <keunyoung@google.com> use s_max_mnt_count to detect mke2fs generated partition

- Old tool will set it to 10 while mke2fs will set it to -1.
- For now, only tag it.
- TODO: possibly add different policy per image tool version.

bug: 32246772
Test: check dmesg after reboot
Change-Id: Ib763f8ba64957412d2b02a9d6e3fc2bfcf55851e
/system/core/fs_mgr/fs_mgr.cpp
e989a22553bc8a6229e379ac215a9281f9d1f846 20-Mar-2017 Mark Salyzyn <salyzyn@google.com> fs_mgr: remove private/android_filesystem_config.h

Test: compile
Bug: 33241851
Change-Id: I3807871dcdfe5c751b1eea6e57c1ff5aac15806e
/system/core/fs_mgr/fs_mgr.cpp
5c31ffe9cdde8912d2f093e787b52c89c5b5e9b8 08-Mar-2017 NIEJuhu <niejuhu@xiaomi.com> fs_mgr: fix errno setted by mount_with_alternatives

mount_with_alternatives should set errno to match the 1st mount failure.

Bug: N/A
Test: run `fs_mgr -a <fake_fstab>` and check dmesg log
Change-Id: If4148d327f75c659b843e95f85568ea49c5d0180
Signed-off-by: NIEJuhu <niejuhu@xiaomi.com>
/system/core/fs_mgr/fs_mgr.cpp
3fbf94e19a97b4358e5df7b7920d8ecc16ab8670 02-Mar-2017 Keun-young Park <keunyoung@google.com> collect fs stat for ext4

- This is to collect data to understand if e2fsck -f option
can be dropped wholly based on information from fs.
- Ideally e2fsck should not fix fs if it was clean shutdown
or if it is not enabling quota.
- The log is added to /dev/fscklogs/log and other system components
can collect it later.

TODO: add mechanism to distinguish old vs new fs generation tool.

bug: 32246772
Test: reboot and check saved logs under different shutdown conditions (clean, non-clean)

Change-Id: Id00fad4c5f8ebbb9f9908164a1026e415df06721
/system/core/fs_mgr/fs_mgr.cpp
e7a1b3757faa3d354ad3f423fa078132a9a84dd4 27-Feb-2017 Sandeep Patil <sspatil@google.com> fs_mgr: make is_device_secure() work even in the absence of properties.

During early mount property area is not initialized, and as a result an
'eng' build will always incorrectly be detected as a 'secure' build by
early mount code path resulting into verity error and consequent boot
loop.

The change here makes sure the is_device_secure() check works with /
without properties based on the 'eng' build based build flag so the
early mount code works fine both ways.

Bug: 35791581
Bug: 27805372

Test: Boot sailfish-{eng,userdebug} builds successfully w/ early
mount enabled

Change-Id: Icd101ccad56b669f49b60bbb3005d5be9f53b02b
Signed-off-by: Sandeep Patil <sspatil@google.com>
/system/core/fs_mgr/fs_mgr.cpp
4d71bc5350a9715314e5d54b32fc4220a9e4787a 25-Feb-2017 Wei Wang <wvw@google.com> fs_mgr: fix const parameter in fs_mgr_do_tmpfs_mount

Bug: 35425974
Test: mma, marlin/angler boot
Change-Id: Ibadd04ad3a7c4ea184a6344d566302d577d8fee3
/system/core/fs_mgr/fs_mgr.cpp
4129f20aafe07431a5950271cf7b9014bee53550 16-Feb-2017 Sandeep Patil <sspatil@google.com> fs_mgr: make fs_mgr_setup_verity public API

Consequently this removes the 'early' version of the exact same API.
This is to be used by early mount code where we need to do
1. setup verity
2. create verity device
3. mount partition
as separate steps since that happens during init first stage.

b/27805372

Test: Boot sailfish successfully

Change-Id: I01abecfdfa210d3e240a291ddcb3d2e9ed39ede6
Signed-off-by: Sandeep Patil <sspatil@google.com>
/system/core/fs_mgr/fs_mgr.cpp
d2462570b8dffd2e83dfb9c6e60f8f39697659b5 15-Feb-2017 Sandeep Patil <sspatil@google.com> fs_mgr: fix the fs_mgr_setup_verity param name

The 'verify_dev' parameter for fs_mgr_setup_verity is confusing, since
it doesn't necessarily control the "verification" part of the function.
Instead, it merely allows the caller to skip the
wait_for_dm_verity_device part of the function. So, rename that
parameter for what it is.

b/27805372

Test: Boot sailfish

Change-Id: I024e02fd728f5cd5bb333d9c3b512861731fa215
Signed-off-by: Sandeep Patil <sspatil@google.com>
/system/core/fs_mgr/fs_mgr.cpp
56f9ada93d83dcd66322635138e334e25bb5e1bd 14-Feb-2017 Sandeep Patil <sspatil@google.com> fs_mgr: add fs_mgr_do_mount_one() API

This is to be used in early mount case where we will have a fully
prepared fstab_rec. fs_mgr_do_mount() does a lot more checks and
spends time preparing verity / avb devices before it does the actual
mount.

b/33254008

Test: Boot sailfish

Change-Id: I4481b5af8d900c8b7e3355b7513c325d8f2ecff2
Signed-off-by: Sandeep Patil <sspatil@google.com>
/system/core/fs_mgr/fs_mgr.cpp
2517da9f97e028e1931cc347bf0b59e7dbedd32e 15-Feb-2017 Keun-young Park <keunyoung@google.com> Revert "e2fsck: drop -f when TARGET_USES_MKE2FS is enabled"

This reverts commit 22e81991750555068131b5d515453c598027c46f.

- revert for now. will collect more data to check safety.

bug: 32246772
Test: reboots

Change-Id: Ibbb39005c64b26e9990c271b0b949feafae17773
/system/core/fs_mgr/fs_mgr.cpp
47878de7d12c7e438fcc584183b44893e91b4a28 23-Jan-2017 bowgotsai <bowgotsai@google.com> fs_mgr: Switch to LOG()/PLOG() defined in <android-base/logging.h>

This is the minimal change just to replace KLOG_{INFO, WARNING, ERROR}
defined in <cutils/klog.h> to LOG()/PLOG() defined in
<android-base/logging.h>.

The logging.h uses program invocation name as the tag when logging.
e.g., init logs will have "init: ..." at the beginning in each line.
To facilitate debugging, this commit adds [libfs_mgr] after the tag,
and the resulting output will like this:

[ 11.278002] init: [libfs_mgr]Enabling dm-verity for system (mode 2)
[ 11.283309] init: [libfs_mgr]loading verity table: '1 /dev/block/platform/soc.0/f9824900.sdhci/by-name/system ...'
[ 11.337884] init: [libfs_mgr]Not running /system/bin/tune2fs on /dev/block/dm-0 (executable not in system image)
[ 11.362281] init: [libfs_mgr]__mount(source=/dev/block/dm-0,target=/system,type=ext4)=0
[ 11.376331] init: [libfs_mgr]Requested quota status is match on /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor
[ 11.398237] init: [libfs_mgr]__mount(source=/dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor,target=/vendor,type=ext4)=0
[ 11.410735] init: [libfs_mgr]Requested quota status is match on /dev/block/platform/soc.0/f9824900.sdhci/by-name/userdata
[ 11.426783] init: [libfs_mgr]check_fs(): mount(/dev/block/platform/soc.0/f9824900.sdhci/by-name/userdata,/data,ext4)=-1: Invalid argument
[ 11.439154] init: [libfs_mgr]Running /system/bin/e2fsck on /dev/block/platform/soc.0/f9824900.sdhci/by-name/userdata

Bug: 34336098
Test: check device can boot

Change-Id: Idcbaca1050e2d8eabe1e4510a0af03aa0312d03a
/system/core/fs_mgr/fs_mgr.cpp
cea7ea78256d4ac84b384dfa57675dab55ef8691 16-Jan-2017 bowgotsai <bowgotsai@google.com> Switch fs_mgr/*.c to C++.

This is the minimal change just to keep it building, and doesn't
attempt to clean up the code.

Bug: 34336098
Test: check device can boot

Change-Id: I5ff897874f1f14a9a5d1f14fedf1b0749e86dbb3
/system/core/fs_mgr/fs_mgr.cpp