diff options
author | Jaegeuk Kim <jaegeuk@google.com> | 2021-12-29 14:44:22 -0800 |
---|---|---|
committer | Randall Huang <huangrandall@google.com> | 2022-01-21 08:35:35 +0000 |
commit | 80a8feec380d36a51fd13338342521409af0b3f4 (patch) | |
tree | 26e2da534bf4a95a36214efd6a9c9ac8495a135c | |
parent | fdff9a34714b22f0bc14059ddd0b35d401be0f05 (diff) | |
download | core-80a8feec380d36a51fd13338342521409af0b3f4.tar.gz |
[DO NOT MERGE] Don't try to mount if the disk has no FS magic
This avoids:
[ 22.932529][ T1] init: [libfs_mgr]Invalid f2fs superblock on '/dev/block/platform/14700000.ufs/by-name/metadata'
[ 22.934609][ T1] F2FS-fs (sda8): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[ 22.935061][ T1] F2FS-fs (sda8): Can't find valid F2FS filesystem in 1th superblock
[ 22.937306][ T1] F2FS-fs (sda8): Magic Mismatch, valid(0xf2f52010) - read(0x0)
[ 22.943700][ T1] F2FS-fs (sda8): Can't find valid F2FS filesystem in 2th superblock
[ 22.951937][ T1] init: [libfs_mgr]__mount(source=/dev/block/platform/14700000.ufs/by-name/metadata,target=/metadata,type=f2fs)=-1: Invalid argument
Bug: 210589189
Bug: 214203920
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I27989b25769eae83eb06ac86146f27baf288b7e1
Merged-In: I27989b25769eae83eb06ac86146f27baf288b7e1
-rw-r--r-- | fs_mgr/fs_mgr.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index 9acc67802..eea5983ae 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -1882,9 +1882,13 @@ int fs_mgr_do_mount_one(const FstabEntry& entry, const std::string& alt_mount_po auto& mount_point = alt_mount_point.empty() ? entry.mount_point : alt_mount_point; // Run fsck if needed - prepare_fs_for_mount(entry.blk_device, entry, mount_point); + int ret = prepare_fs_for_mount(entry.blk_device, entry, mount_point); + // Wiped case doesn't require to try __mount below. + if (ret & FS_STAT_INVALID_MAGIC) { + return FS_MGR_DOMNT_FAILED; + } - int ret = __mount(entry.blk_device, mount_point, entry); + ret = __mount(entry.blk_device, mount_point, entry); if (ret) { ret = (errno == EBUSY) ? FS_MGR_DOMNT_BUSY : FS_MGR_DOMNT_FAILED; } |