[DO NOT MERGE] Mount /mnt/scracth with -o sync,nodiscard

"-o discard" issues UNMAP commands to loopback resulting in punch_hole
on the pinned file in /data. That will break the pinned block map.

Bug: 210589189
Bug: 214203920
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Ia927c43fc75164ce5929173f5740737eac4de484
Merged-In: Ia927c43fc75164ce5929173f5740737eac4de484
diff --git a/fs_mgr/fs_mgr_overlayfs.cpp b/fs_mgr/fs_mgr_overlayfs.cpp
index cd113f6..cb2f249 100644
--- a/fs_mgr/fs_mgr_overlayfs.cpp
+++ b/fs_mgr/fs_mgr_overlayfs.cpp
@@ -866,6 +866,8 @@
             errno = save_errno;
         }
         entry.flags &= ~MS_RDONLY;
+        entry.flags |= MS_SYNCHRONOUS;
+        entry.fs_options = "nodiscard";
         fs_mgr_set_blk_ro(device_path, false);
     }
     // check_fs requires apex runtime library