Avoid ro->rw->ro mounts for /factory
When manta boots, the /factory partition was handled as follows:
1) Mount /factory read-only from fstab.manta
2) Remount /factory read-write from init.manta.rc
3) Update SELinux labels on /factory via restorecon_recursive /factory
4) Remount /factory read-only from init.manta.rc
Due to system/core commit e18c0d508a6d8b4376c6f0b8c22600e5aca37f69,
when a read-only partition is mounted via fstab.manta, we also set
the BLKROSET ioctl so that the underlying block device is also marked
read-only. This breaks the above sequence of steps.
Specifically, when we attempt to remount /factory read-write, the kernel
realizes that the underlying block device is marked read-only, and
refuses the remount. This causes the restorecon_recursive call to
fail.
This change simplifies the above sequence by avoiding the initial
read-only mount. The steps are now:
1) Mount /factory read-write from fstab.manta
2) Update SELinux labels on /factory via restorecon_recursive /factory
3) Remount /factory read-only from init.manta.rc
Bug: 18036999
Change-Id: I39fde77e85242c67f67bb601d4ffcdb3b4b087df
diff --git a/fstab.manta b/fstab.manta
index 3c8411d..9096a04 100644
--- a/fstab.manta
+++ b/fstab.manta
@@ -7,7 +7,7 @@
/dev/block/platform/dw_mmc.0/by-name/system /system ext4 ro wait
/dev/block/platform/dw_mmc.0/by-name/cache /cache ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check
/dev/block/platform/dw_mmc.0/by-name/userdata /data ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,encryptable=/dev/block/platform/dw_mmc.0/by-name/metadata
-/dev/block/platform/dw_mmc.0/by-name/efs /factory ext4 noatime,nosuid,nodev,ro wait
+/dev/block/platform/dw_mmc.0/by-name/efs /factory ext4 noatime,nosuid,nodev,rw wait
/dev/block/platform/dw_mmc.0/by-name/boot /boot emmc defaults defaults
/dev/block/platform/dw_mmc.0/by-name/recovery /recovery emmc defaults defaults
/dev/block/platform/dw_mmc.0/by-name/misc /misc emmc defaults defaults
diff --git a/init.manta.rc b/init.manta.rc
index b5c8f07..0442416 100644
--- a/init.manta.rc
+++ b/init.manta.rc
@@ -57,7 +57,6 @@
mkdir /factory 0775 radio radio
mount_all /fstab.manta
- mount ext4 /dev/block/platform/dw_mmc.0/by-name/efs /factory rw remount
restorecon_recursive /factory
mount ext4 /dev/block/platform/dw_mmc.0/by-name/efs /factory ro remount
setprop ro.crypto.fuse_sdcard true