fs_mgr: overlayfs: noatime

Should not have used relatime for overlayfs and backing storage
mounts, noatime reduces the wear and tear on the flash device.

This should prevent triggering a falure in the CtsOsTestCases that
tries to spot mounts attached to block storage from updating atime
and resulting in churn.  This statement does not mean we support
performing Cts tests with devices that have deployed
'adb disable-verity' or 'adb remount'.

Post-mortem: relatime was not a 'problem' for overlayfs, copy and
             paste for those flags resulted in the use of relatime
	     for scratch backing storage.

Test: adb-remount-test.sh
Bug: 140014856
Change-Id: Ic97b98ceacaa265094364487ea70cc99b6aee92f
This commit is contained in:
Mark Salyzyn 2019-08-28 12:53:26 -07:00
parent 24f955155a
commit 808763e825
2 changed files with 7 additions and 2 deletions

View file

@ -713,7 +713,7 @@ bool fs_mgr_overlayfs_mount(const std::string& mount_point) {
}
report = report + ")=";
auto ret = mount("overlay", mount_point.c_str(), "overlay", MS_RDONLY | MS_RELATIME,
auto ret = mount("overlay", mount_point.c_str(), "overlay", MS_RDONLY | MS_NOATIME,
options.c_str());
if (ret) {
retval = false;
@ -776,7 +776,7 @@ bool fs_mgr_overlayfs_mount_scratch(const std::string& device_path, const std::s
entry.fs_type = mnt_type;
if ((mnt_type == "f2fs") && !f2fs) entry.fs_type = "ext4";
if ((mnt_type == "ext4") && !ext4) entry.fs_type = "f2fs";
entry.flags = MS_RELATIME;
entry.flags = MS_NOATIME;
if (readonly) {
entry.flags |= MS_RDONLY;
} else {

View file

@ -1190,6 +1190,11 @@ if ${overlayfs_needed}; then
skip_unrelated_mounts |
grep " overlay ro,") ||
die "remount overlayfs missed a spot (ro)"
!(adb_sh grep -v noatime /proc/mounts </dev/null |
skip_administrative_mounts data |
skip_unrelated_mounts |
grep '.') ||
die "mounts are not noatime"
D=`adb_sh grep " rw," /proc/mounts </dev/null |
skip_administrative_mounts data`
if echo "${D}" | grep /dev/root >/dev/null; then